DiscoTOC - automatic table of contents

Hello…

I have a problem with using DiscoTOC, maybe someone has an idea.

Imagine DiscoToc, working perfectly, for a topic, as an example:

  • link a → adds “link-a-1” to the end
  • link b → adds “link-b-2” to the end

Suppose I shared link a with someone: (“…link-a-1”)

Now, imagine that I reordered the topics (I put “link b” before).
Using DiscoToc, it looks like this:

  • link b → adds “link-b-1” to the end
  • link a → adds “link-a-2” to the end

And from now on, the link I had shared no longer works.
I shared (“…link-a-1”), but now the correct one is (“…link-a-2”)

I would really appreciate it if anyone has any ideas.

2 Likes

BUG REPORT!

En-dashes and em-dashes autogenerated by groupings of 2 or 3 dashes no longer work when DiscoTOC is active. Instead of – or — they go back to being -- or ---.

2 Likes

Hope to add an option to support opening the directory function for all posts with one click!

1 Like

2024-11-02T22:00:00Z
Error report: When clicking on a directory, the displayed content position does not match the directory’s location

Basically, the current page “DiscoTOC - automatic table of contents” is also incorrectly located.

Can you be more specifici and provide an example. the TOC is loading and working as expected for me on all my Discourse forum instances.

The page you linked loads properly and the TOC is working.

2 Likes

Thank you for your reply. I haven’t found the problem now, but there was indeed a problem at that time.

A post was split to a new topic: Add button to TOC theme component

Reader Mode conflics with Disco TOC

it seems we can’t have both the Table of Content (by DiscoTOC, mandatory for big documents) and Reader Mode (also mandatory for big documents)

the TOC list overlaps and hides Reader Mode icon (and the post operations menu icon)

4 Likes

Question on topic - Is there a function or plugin that can automatically generate a list of all the category topics, to help generate up TOC or even Wiki type post content?

This is a save manual effort fix.

A little scripting, but it would be interesting to have maybe a tag that would do it, then being native to discourse, something that prints all the topics (titles) in a speech category (and live links them).

However I suppose it might be better implemented within the LINK button feature, when you click you can input-search for the topic you are looking, but now you have a new top level option like

"Print-links : all topic titles from X category" button :slight_smile:

I would assume order by topic date new/old toggle would be useful.

This is probably a feature request but I thought I would inquire here as it is more relevant as I was thinking of use case with DiscoTOC, as to to do this manually.

Maybe AI does this but we don’t use the AI features, perhpas it really is more aligned as a breakout of the LINK button feature maybe more than DiscoTOS and there might be a wider application usage base than even I am imaging.

I imagine this is fairly obvious, but this component doesn’t work with the Blog Post Styling component as that hides the sidebar.

I suggest having an ‘inline TOC’ option, like how the plugin used to be, if there’s any interest in making them work together.

The inline one is useful as an option so being able to switch would be wonderful. Its great for some usecases because its really obvious for users, while the new one is smarter but a little tucked away and can be missed.

When your primary intention is for all users to jump right to the section they are interested in, the inline version would be a better choice.

1 Like

I wanted to share some feedback regarding the DiscoTOC plugin. In most Discourse themes, the TOC sidebar is displayed with an appropriate width, ensuring that long titles are handled gracefully. However, when using the Horizon theme, the sidebar width is noticeably narrow, which causes long titles to break into multiple lines. This limits readability and affects the overall visual consistency of the interface.

Could you please consider investigating this issue specifically for the Horizon theme and explore options to adjust the sidebar’s width for a better presentation of longer titles? I believe addressing this would enhance the user experience for many on the Horizon theme.

Thank you for your hard work and for considering this suggestion.

2 Likes

Subject: discoTOC component malfunction in Persian locale

Environment: Forum with Default locale set to “Persian”.

Component Affected: discoTOC

Description: When the forum’s default locale is configured to “Persian”, the discotoc component fails to function correctly.

Specific Symptoms:

  1. The UI elements for “Timeline” and “Contents” buttons are not displayed.
  2. After a user submits a reply to a topic, the table of contents view is automatically hidden, the timeline view is shown, and there is no interactive element provided to restore the table of contents view.

Regarding the above instructions on using the discoTOC component, I have a few technical questions for clarification:

  1. Step 1 mentions writing a topic with headings and Step 2 mentions using a specific button. If I follow Step 1 by structuring my topic with markdown headings (e.g., ##, ###) but omit clicking the “toc button” in the gear menu (Step 2), will the discoTOC component still automatically generate or display the table of contents based solely on the headings? In essence, is clicking the button mandatory for the component to function correctly, or is it merely a trigger for inserting a specific element?
  2. What is the precise purpose or functionality of the “toc button” located in the gear menu? How is this button intended to be used within the topic editor workflow?
  3. Separately, I’ve encountered the snippet <div data-theme-toc="true"> </div>. Could you please explain its exact role in conjunction with discoTOC? What does this div element control, and how should it be implemented or configured within the topic content to affect the table of contents generation or display?

Thank you for your detailed explanation.

I’m not sure if this is technical enough, but the component needs both the <div data-theme-toc="true"> </div> and some headings in the post to be able to generate a proper toc.

Without the <div data-theme-toc="true"> </div> inserted the post will simply be a post with headings, and adding that without including any headings will not generate a toc (there’s also a TOC min heading setting in the component, which defaults to 3. So you’d need at least 3 headers in your post to generate a visible toc)

The ‘insert table of contents’ button inserts the <div data-theme-toc="true"> </div> into the post, though you can copy this in or type it manually to the same effect.

Hopefully that helps. :crossed_fingers:


ETA: I’ve just had a gentle nudge reminder that if you’re using the Auto TOC categories and Auto TOC tags component settings then inserting the <div data-theme-toc="true"> </div> isn’t necessary in those cases. :+1:

5 Likes

Also… there’s a setting for this now (Enable TOC for replies) so you can have a toc in a reply. :partying_face:

3 Likes