DiscoTOC - automatic table of contents

I am wondering how the TOC plugin is intended to function as I am finding its behaviour sort of odd. I have attached an animated gif below showing my observed behaviour. Is this intentional?

My personal thought/preference is that the TOC is just fully expanded from the start.

Thanks in advance!

1 Like

I am bumping this in hopes that someone will comment on the above functionality.

Is this functionality as intended? Am I doing something wrong? Is there a possibility to get the option to set the TOC to be fully expanded and static?

Thanks in advance!

1 Like

Is there a plan, that the TOC is also visible for published pages? Page publishing was a feature introduced in discourse 2.5? This would be a huge benefit of this theme component!

6 Likes

I checked it with non-Latin symbols like Cyrillic and it’s not working. When I copy the url of the subheader and try to follow the link - the TOC is not working (the page opens, but doesn’t move to the subheader). How can it be solved?

1 Like

Another question. I added extra div to the post. Now it looks like this:

<div data-theme-toc="true"> </div>
<div data-theme-profile="manual">
## Chapter 1
## Chapter 2
</div>

But the TOC is not visible in this case. How can it be fixed?

1 Like

In 2.7.0.beta6: Automatic Group Avatar Flair, Improved User Education Content, Bookmark Pinning, and more - feature / announcements - Discourse Meta Discourse added automatic generation of header links. How does that work with disco-toc generated headers? Can disco-toc use the discourse-generated links?

What about posts which have same header multiple times? (this bug already exists, and i reported it before here)

eg

Head1

Example

Head2

Example

This second ##### Example has the same url as the first example, from what i can see.

2 Likes

Hmm, @nbianca, any thoughts?

Hi, I noticed an odd interaction with DiscoTOC and Slack integration. Basically the header links don’t properly post.

See details here

2 Likes

That is because the heading links do not include the path to the topic. For example <a name="overview" href="#overview">. The Chat Integration plugin is attempting to convert relative links into absolute links by prepending the forum’s root URL to any links in the post, but that is not going to work for the header links because the path to the topic is missing.

A possible solution would be for us to add the path to the topic to the TOC href element. For example, instead of setting <a name="overview" href="#overview">, the href element would be set to something like /t/your-topic-slug/1234#overview".

1 Like

Hello,

How I can add into all my existing post the toc ?
I don’t want add this manually :slight_smile:
Perhaps with rake post ?

regards

Ludo

1 Like

After the “Automatic header anchor links” from 2.7.0.beta6, all headers on a topic with DiscoTOC are getting two anchors, one at its left (from core) and one at its right (from the theme component), like this:
image

2 Likes

@renato Doesn’t work. I will try again.

I have another issue with DiscoTOC, When I add TOC I can’t used the menu to Reset Bump Date.

No icon available to that. The right menu is missing and I have my TOC.