Skip to content

Table of contents

::toc
::toc{depth=2}
::toc{depth=2 title="Inhalt"}
::toc{title=""}
AttributeValuesDefaultMeaning
depth1–63Include headings of this level and above
titlequoted text"Contents"The title above the list; title="" shows no title
table-of-contents/document.md
# Field guide
::toc{depth=2 title="Contents"}
::pagebreak
## Leaves
MDLeaf lays Markdown out on real pages. Paragraphs flow from page to page, and the page view shows exactly what the PDF will contain.
MDLeaf lays Markdown out on real pages. Paragraphs flow from page to page, and the page view shows exactly what the PDF will contain.
### Shapes
Not listed: depth is 2.
::pagebreak
## Bark
MDLeaf lays Markdown out on real pages. Paragraphs flow from page to page, and the page view shows exactly what the PDF will contain.
MDLeaf lays Markdown out on real pages. Paragraphs flow from page to page, and the page view shows exactly what the PDF will contain.
::pagebreak
## Roots
MDLeaf lays Markdown out on real pages. Paragraphs flow from page to page, and the page view shows exactly what the PDF will contain.
::toc lists the headings with the page they appear on. Entries are links, in the preview and in the PDF.
Download sample (.mdl)

Open it in MDLeaf with Library → Import .mdl. If MDLeaf is installed, you can also open the file directly.

  • Every heading of the document up to depth is listed, in order — including headings above the table. Headings inside quotes, lists and footnotes are not listed.
  • Each entry shows the heading text, a dotted leader and the displayed page number (after any numbering changes). In draft view the numbers are empty; they are filled in by page view.
  • Each entry is a link to its heading, in the preview and in the PDF.
  • The title is not a heading, so the table never lists itself. You can use ::toc more than once; each shows the same list.
  • ::toc{depth=7} — depth must be 1 to 6: directive-attr-invalid, and no table is shown.
  • ::toc{title=Table of contents} — values with spaces need quotes: title="Table of contents".