Markdown TOC Generator
NewPaste markdown with headings and generate a GitHub-style table of contents with anchor links, in bulleted or numbered format.
Frequently Asked Questions
How are the anchor slugs generated?
Using the same algorithm GitHub uses for its automatic heading anchors: lowercase the heading text, strip characters that aren't letters/numbers/spaces/hyphens, then replace spaces with hyphens — so a heading like "API Reference!" becomes the anchor "#api-reference".
What happens with duplicate heading text?
GitHub (and this tool) appends -1, -2, etc. to repeated slugs in the order they appear, matching how GitHub disambiguates duplicate headings in its own rendered TOC anchors.
Does it ignore headings inside fenced code blocks?
Yes — lines between triple-backtick fences are skipped entirely, so a "# comment" inside a code sample won't be mistaken for a real markdown heading.
What does the "Max depth" selector control?
It limits which heading levels are included — for example, selecting H3 includes H1/H2/H3 headings but excludes H4-H6, which keeps deeply nested sub-sections out of a high-level TOC.
Can I generate a numbered TOC instead of bullets?
Yes — toggling "Numbered list" switches each entry to a hierarchical numbered format (1., 1.1., 1.2., etc.) instead of markdown bullet dashes.