Markdown Table of Contents Generator
Paste a Markdown document. Pick a depth, a list style and a slug algorithm. Get a copy-paste-ready table of contents with anchor links that work on GitHub.
- [Background](#background) - [Site conditions](#site-conditions) - [Soil](#soil) - [Sunlight](#sunlight) - [Proposed layout (v2)](#proposed-layout-v2) - [Phase 1: Beds](#phase-1-beds) - [Phase 2: Pavilion & rainwater](#phase-2-pavilion-rainwater) - [Costs & timeline](#costs-timeline) - [Next steps](#next-steps)
How the slug algorithm works
GitHub turns ## Site conditions into the anchor #site-conditions. Most static-site generators follow the same rule. The toggle in the panel switches between that style and a stricter one that strips parenthesised text - useful when a generator (or your house style) treats brackets as noise.
When two headings produce the same slug, GitHub appends -1, -2 and so on. The generator does the same so the second Background heading links to #background-1, not the first one.
Options, briefly
- Max depth - heading levels deeper than this are ignored. Three is usually enough for long-form documents.
- Include H1 - off by default. The page title is already the H1; the TOC starts at H2.
- List style - bullets render everywhere; the ordered, em-dash and dot variants are for when you want the TOC to visually match the rest of the document.
- Slug style - GitHub for almost every case; strict when a generator (Hugo, Zola) rejects punctuation that GitHub keeps.
- Leading icon - drop in a section symbol or arrow; left blank by default.
Where the TOC goes in your document
Conventionally, right after the lede paragraph and before the first H2. Some teams precede it with a small heading like Contents; others rely on the visual treatment of the list to read as a TOC on its own. Either is fine.
Compatibility
- GitHub and GitLab - anchor links work as soon as the file renders.
- Obsidian, VS Code preview, Typora - same.
- Notion - Markdown import keeps the list; the in-page anchor scrolls to the heading.
- md2document - exports include a clickable TOC in the PDF; the converter also has a built-in auto-TOC if you prefer.
Runs in your browser - nothing is sent to a server.
Related
- Open the converter → get an auto-TOC in the exported PDF.
- How to make tables in Markdown - the long-form companion guide.
- Page breaks in Markdown - pair with a TOC for printable documents.
- Markdown link generator - for one-off anchor links.