Skip to content

Markdown TOC Generator

Generate a nested Markdown table of contents from your headings with GitHub- or GitLab-style anchor links, skipping headings in code fences.

Markdown TOC Generator

7 headings found

Updated . Provided as is. Check the output before you rely on it in production.

How to use Markdown TOC Generator

  1. 1

    Paste your Markdown

    Drop your README or document into the input box, or load the sample to see the expected format.

  2. 2

    Choose the heading range

    Set the minimum and maximum heading levels so the table of contents covers only the depth you want.

  3. 3

    Pick list and anchor style

    Select a bulleted or ordered list, and choose GitHub or GitLab anchor slugs to match your platform.

  4. 4

    Copy the result

    Review the nested table of contents, then copy it and paste it near the top of your document.

Questions and answers

What does the Markdown TOC Generator do?
A Markdown table of contents is a nested list of links to a document's headings, often placed at the top of a README. This generator reads ATX headings (# to ######) within your chosen level range, skips any inside code fences, and links each entry to its GitHub- or GitLab-style anchor.
How are the anchor links generated?
Headings are slugified the GitHub way: lowercased, punctuation stripped, spaces turned into hyphens, and duplicate slugs get a -1, -2 suffix.
Does it support GitHub and GitLab anchors?
Yes. Switch the anchor style between GitHub and GitLab; the GitLab style additionally collapses repeated hyphens and trims them from the ends.
Why are some headings left out of the table of contents?
Headings inside fenced code blocks (``` or ~~~) are ignored, and only headings within your chosen minimum and maximum level range are included.
Is my document uploaded anywhere?
No. Parsing and slug generation run entirely in your browser, so the Markdown you paste never leaves your device.
For AI agents: how to call this tool

Machine-readable contract, endpoints and examples. Humans can ignore this section.

Best Path For Builders

Browser workflow

Runs instantly in the browser with private local processing and copy/export-ready output.

Browser Workflow

This tool is optimized for instant in-browser execution with local data handling. Run it here and copy/export the output directly.

/markdown-toc-generator/

For automation planning, fetch the canonical contract at /api/tool/markdown-toc-generator.json.