New Feature: Table of Contents

Today, we’re launching a new feature that I hope will be helpful. We’re adding the option to add a Table of Contents to topics. They appear in the topic sidebar and reflect the H2,H3,H4 tags within posts.

When you get to the comment section the table of contents will disappear. You can see how this works on our Best White Elephant Gifts topic.

Here’s what the TOC looks like on our Best Shave Club review.

And this is the same table of contents on mobile. There is a button that either opens or closes the TOC.

How does it work?

In a nutshell, it looks for headings in topics which are marked to have a toc (via the composer button) and if it turns out the current topic is marked, then it takes all the headings and puts them in the toc (nested in order of heading levels) - this means that your markdown must be syntactically correct .

# heading 1
## heading 2
### heading 3
#### heading 4
##### heading 5
###### heading 6

You’re free to go back and fourth in heading levels, but the order must be correct

# heading 2 
## heading 3
## heading 3
### heading 4
## heading 3
# heading 2

Once all of that is done, it will also add a link next to each button that links directly to that section.

Adding a TOC

When creating a topic—not a post or comment— click the gear icon and then click Insert Table of Contents.

That’s it!