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…?

I installed the DiscoTOC 2.1.0 theme component, but the option to generate a TOC isn’t showing up under the ā€œ+ā€ in the composer dialog. I’m on Discourse 3.6.0.beta1-dev. In the ā€œ+ā€ menu I see Quote whole post, Insert table, Hide details, Insert date/time, Add footnote, Build poll, and Blur spoiler.

Are there any other ā€œwon’t work withā€ scenarios? This site has the ā€œCustom Header Linksā€ theme component and a several plugins.

So far I tried it on a wiki topic post and a non-wiki topic post.

Test document:

# Top heading

## Second level heading

## Another second level heading

### Whoa, a third level heading

## Yet another second level heading

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

Thank you so much for taking so much time in your response! I apologize, but the problem is with me and Apple. I am using Safari on a new Mac, and the ā€œ+ā€ menu when it opens does contain the TOC option, but it is not visible in the list, and the menu does not flash the scrollbars at all that I can see (and they do not appear unless you scroll). The vertical alignment of the content just happened to be perfect, as if it contained N-1 items instead of N. Grrrr. I finally noticed when I tried this in Chrome, and by chance the N-1st item was cut in half, so I scrolled ….

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