Is there markdown for creating a table of contents in a topic?

markdown

(Tobias Eigen) #1

A drupal module I regularly lean on provides [toc] functionality to automagically generate a table of contents linking to all headings on a page. It’s great for FAQs and step by step howtos etc, which I could imagine being really useful for using discourse to share such information. Just add [toc] and you get something like this:

This looks like markdown but I tested it and it doesn’t have the same effect in discourse - is such a thing possible with markdown?


Wiki topic mini spec
Is anyone working on a Discourse Wiki?
HTML anchors should be added
Working with specific structures
Proposing Jekyll as community wiki platform
(Jeff Atwood) #2

You can generate headers via the # and ## and ### at the start of lines, that’s about it. So no.


(Sam Saffron) #3

I am thinking we should possibly auto-enable a TOC like widget for wiki posts (beyond a certain length). Its quite trivial to implement.


(Jeff Atwood) #4

Would need a spec topic first.


(Tobias Eigen) #5

What’s a spec topic? Can I help with this?


(Jeff Atwood) #6

Look for the category titled “spec”


(Tobias Eigen) #7

Looks like I can’t add topics to the spec category. This isn’t too hard to explain so let me provide what I know here and you can decide what to do with it.


(Sam Saffron) #8

Yes, by design, just make an uncategorized topic, we will move it to specs once we bless it.

Needs more meat than the above :slight_smile: ideally with a mockup or more examples.


(Alessio Fattorini) #9

Please, we need this for our howto :smile:


(Tobias Eigen) #10

Looks like Discourse v1.4 will get us part of the way there for this:

  • HTML anchor support that works for deep linking to headings in a post

So we’ll be able to manually create a table of contents linking to headings. Lovely!

Even more lovely would be to be able to add [toc] in a post to automatically generate this list of links to headers within the post.


Spec: Table of Contents