DiscoTOC - automatic table of contents

4 likes

Thank you and sorry for missing that…

Works like a charm! Really appreciate your time and help! :raising_hands:

2 likes

Everything is working, but:

  1. On mobile I don’t see the button “Table of Contents” as shown in the instructions:

  1. The only way to see it is to add at least a comment/reply (I would expect it to show even if no replies were added?), but even then, what is shown is not the same as what is in the image:

Is it possible to make it show “Table of Contents”, not just the icon? I’m thinking that maybe it’s possible via CSS, but I was wondering if this is a new “feature” or something else I can change to show the text?

I even tried to change the default text, in case that was the issue, but no luck:

image


EDIT: I was able to add the text via CSS in a custom component, but still wondering if this is a bug or something?

@media screen and (max-width: 767px) {
  .d-toc-mini button::after {
    content: "Table of Contents";
    margin-left: 5px;
    font-size: 14px;
    vertical-align: middle;
  }
}

And I still haven’t figure out the issue of it only being visible at the bottom (instead of "sticky) when there’s no replies.

The screenshots in the first post are quite old. You won’t find any information about the button which allows you to toggle between timeline and toc when there is more than one post, or information about the toc for replies feature, in them.

The problem with the missing button on mobile was reported here:

Maybe you also want to support this feature request: Fully expand table of content, if you’d prefer official support instead of custom CSS.

2 likes

I was able to make it work when it doesn’t have a reply:

I just added my feedback on that topic. Thanks.

1 like

I noticed that something is broken.
On mobile, the TOC panel doesn’t slide overlaying the topic. It gets added at the bottom:

I thought it could be an issue with any of the other components, but I disabled them all and just left this one on.


EDIT: I noticed that this issue is only visible is the topic has no replies. I added a testing reply, and now it’s working. Even a simple Unlist > List, will work:

image

Bug…?

Ik heb de DiscoTOC 2.1.0 thema-component geïnstalleerd, maar de optie om een TOC te genereren wordt niet weergegeven onder de “+” in het composer-dialoogvenster. Ik gebruik Discourse 3.6.0.beta1-dev. In het “+” menu zie ik “Hele bericht citeren”, “Tabel invoegen”, “Details verbergen”, “Datum/tijd invoegen”, “Voetnoot toevoegen”, “Poll bouwen” en “Spoiler vervagen”.

Zijn er nog andere “werkt niet met”-scenario’s? Deze site heeft de “Custom Header Links” thema-component en verschillende plugins.

Tot nu toe heb ik het geprobeerd op een wiki-bericht en een niet-wiki-bericht.

Testdocument:

# Hoofding
## Tweede niveau kop
## Nog een kop van het tweede niveau
### Wow, een kop van het derde niveau
## Nog een kop van het tweede niveau

I guess you added the component to your theme and you have already tried to refresh the site in the browser after that (Just mentioning that because I sometimes forget).

Did you try the preview button of the theme? That can be helpful to check for a conflict with another component (Though I think it’s unlikely)

You can also try to add the text that the button in the composer menu adds to the post manually


<div data-theme-toc="true"> </div>


Does that work?

1 like

Hartelijk dank voor de uitgebreide reactie! Mijn excuses, maar het probleem ligt bij mij en Apple. Ik gebruik Safari op een nieuwe Mac, en het “+” menu wanneer het opent bevat wel de TOC-optie, maar deze is niet zichtbaar in de lijst, en het menu toont helemaal geen scrollbalken die ik kan zien (en ze verschijnen pas als je scrollt). De verticale uitlijning van de inhoud was toevallig perfect, alsof het N-1 items bevatte in plaats van N. Grrrr. Ik merkte het eindelijk toen ik dit in Chrome probeerde, en toevallig was het N-1e item half zichtbaar, dus ik scrolde…

3 likes

I’m glad you found it.
I actually had similar problems once: Last item of reply composer gear menu inaccessible I haven’t tried it in a long time to see if it’s better now.

2 likes

PSA, I’m getting this in my console log:

2 likes

Thanks for reporting it! We’ve just updated the component to fix this

3 likes

Been seeing this warning in the logs after updating to the latest discourse build last week

Message

DiscoTOC theme/component is throwing errors:
TypeError: Failed to fetch dynamically imported module: https://ccc.xxx.com/theme-javascripts/fb8891ef8c38dab255d356c75588ff25d4a97805.js?__ws=ccc.xxx.com

Backtrace

TypeError: Failed to fetch dynamically imported module: https://ccc.xxx.com/theme-javascripts/fb8891ef8c38dab255d356c75588ff25d4a97805.js?__ws=ccc.xxx.com

Env

are both your Discourse and TOC component up-to-date? I cannot reproduce those errors.

Yes, discourse is updated as of Nov 11th 3.6.0.beta3-latest(aee3db7cdd) and components are update to date also. I’m also seeing a similar error for another component

Message

Discourse Top Contributors Sidebar theme/component is throwing errors:
TypeError: Failed to fetch dynamically imported module: https://ccc.xxx.com/theme-javascripts/ddc9fd1b23f86d280ce4a9dbefc40b751d5fb8b4.js?__ws=ccc.xxx.com

I’ve tried a rebuild also but it didn’t go away. What else can I try? Also what impact does this error have on the site?

Hey here:

Quick question here and sorry for the (probably) already reported issue; i did not find where.

It seems that there is a display issue with the (great) horizon theme (screenshot here on meta, with iOS on vertical display). Is it logged for some future release?

Tks :folded_hands:.

1 like

Yes, there is a topic about this:

3 likes

Great. Tks for the quick response.

1 like

These errors do not affect Discourse itself. They originate from the client side, likely caused by users with unstable connections, ad blockers, or other browser extensions interfering. @david has just submitted a PR to suppress these warnings, as they are essentially unavoidable, stemming from external factors rather than anything within Discourse.

2 likes