Markdown table of contents generator

Paste a Markdown document and get a nested table of contents with GitHub-style anchor links, headings inside code fences ignored, and the depth range and list style under your control.

List
md
Table of contentsmd
The result appears here
Made something you like?Blog post blocks with a contents rail

Questions

How are the anchors made?+

The same way GitHub does it: lowercase, punctuation removed, spaces turned into hyphens, and a repeated heading gets -1, -2 and so on. Letters outside ASCII are kept, so a heading in any language still links.

Why is my H1 missing?+

The range starts at H2 by default because a document usually has one H1 and it is the title, not a section. Set From to H1 if you want it in the list.

Does it read headings inside code blocks?+

No. A line starting with # inside a fenced block is a shell comment or a Markdown sample, not a heading, so fences are skipped entirely.

Related tools

The tools are free. So is most of the library.

2095 blocks and 1076 pieces for shadcn/ui and Tailwind, built on the same tokens these tools write. Install one with a command and the code is yours.

No signup for the tools. MIT for free blocks, commercial licence for Pro.

Markdown version