# Markdown TOC Generator

Generate a table of contents for a Markdown document. Paste a README or documentation page, choose the heading levels to include, and get a nested list with links to each heading's anchor, written the way GitHub creates heading IDs. Headings inside code blocks are skipped and duplicate headings get numbered anchors.

## Frequently asked questions

### How are the anchor links created?

The same way GitHub creates heading IDs: the heading text is lowercased, punctuation and symbols are removed, and spaces become hyphens. Getting Started becomes #getting-started and C++ & Rust becomes #c--rust.

### What happens with headings that appear twice?

Like on GitHub, the second heading with the same text gets -1 added to its anchor, the third -2 and so on, so every link points to the right section.

### Which headings are recognized?

ATX headings that start with one to six # characters and setext headings underlined with = or -. Headings inside fenced code blocks, indented code and YAML front matter are ignored.

### How is formatting inside headings handled?

Links keep only their text, inline code loses its backticks, emphasis markers and HTML tags are removed, and images are dropped. The entry text and the anchor are both made from this plain text.

### Which heading levels are included?

Levels 2 and 3 by default, because the level 1 heading is usually the document title. Set the lowest and highest level from 1 to 6. The list is indented relative to the highest level found.

### Can I get a numbered list or plain text?

Yes. Choose a numbered list to get 1., 2. and nested numbering, and turn off links to get only the heading texts, for example for a printed outline.

Your ad here?

[Email us](mailto:hi@dennn.is?subject=Advertising%20on%20OneClick%20Pro)

[Ad 433 tools for your AI agents through one MCP server.](https://multitaskai.com/?ref=oneclickpro)
