Table of contents

Dan Dascalescu ddascalescu+markdown at gmail.com
Thu Apr 23 06:59:00 EDT 2009


Sherwood Botsford wrote:

> I *don't* think that markdown is the place for this however.

> I think this is better approached by your page generating software.


MojoMojo uses MultiMarkdown, and I wrote a TOC plugin for it. It uses
HTML::Toc to generate the tableof contents from the HTML that MMD
spits out. The syntax is:

{{toc M- }} # start from Header level M
{{toc -N }} # stop at Header level N
{{toc M-N }} # process only header levels M..N

where M is the minimum heading level to include in the TOC, and N is
the maximum level (depth). For example, suppose you only have one H1
on the page so it doesn't make sense to add it to the TOC; also,
assume you and don't want to include any headers smaller than H3. The
{{toc}} markup to achieve that would be:

{{toc 2-3}}

Dan


More information about the Markdown-Discuss mailing list