Table of contents

Daniel Winterstein daniel.winterstein at gmail.com
Thu Mar 5 04:27:51 EST 2009


I'm using Markdown in an app and would like to provide support for including
a table of contents.
Any suggestions for a syntax? Has anyone done this before?
My first thoughts are:

1. Have a special header item (using markdown extra's header syntax), e.g.

generate-contents: yes

2. Have a special xml tag with optional alternative text inside, e.g.

<contents>
1. First thingy
2. Second thingy
3. Other stuff
</contents>

3. Detect that a set of list items matches the first few headers. E.g. if
the document has headers

# Monkeys
## Chimps
## Humans
## Proboscis monkeys
## Other monkeys
## Do Lemur's count?

Then a list that ran:

1. Monkeys
1. Chimps
2. Humans

Would be detected as the start of a contents list, and the other entries
would automatically be added to it. This seems the nicest approach in some
respects, but also the one likely to cause confusion and annoyance.

Your thoughts?
- Daniel
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://six.pairlist.net/pipermail/markdown-discuss/attachments/20090305/c9a21b35/attachment.html>


More information about the Markdown-Discuss mailing list