A markdown table of contents generator turns the headings in a markdown
document into a clean, linked list you can drop at the top of a README, wiki
page, or long article. Paste your markdown on the left and a ready-to-use TOC
appears on the right, with every entry already pointing at the right anchor.
It is built for anyone who maintains documentation: open-source maintainers
polishing a README, technical writers assembling a handbook, or anyone who
wants a navigable outline without hand-writing dozens of [link](#anchor)
lines.
The generator understands real-world markdown, not just the simple cases. It
reads ATX headings (the # to ###### style) and Setext headings
(text underlined with === or ---), skips anything inside fenced code
blocks so a # in a shell example never becomes a phantom entry, and strips
inline formatting such as bold, italics, links and inline code from the
heading text so the TOC reads cleanly.
How it works
Every line is scanned in order. Lines that open or close a fenced code block
(three or more backticks or tildes) toggle a “code” state, and headings found
while inside a fence are ignored. Outside fences, a leading run of one to six
# characters marks an ATX heading, and a non-blank line followed by === or
--- marks a Setext heading. For each heading the tool computes a
GitHub-style anchor slug — lower-cased, punctuation removed, spaces turned
into hyphens — and de-duplicates repeats by appending -1, -2, and so on,
exactly the way GitHub does.
You then choose which heading levels to include (say H2 through H4 to skip the
document title and the deepest notes), the bullet style (dash, asterisk,
numbered, or plain), how many spaces to indent each nested level, and whether
to add a ## Table of Contents heading. The output updates live. When you are
happy, copy just the TOC, download it as a .md file, copy the full document
with the TOC merged in, or insert it back into the editor — at your chosen
marker, after the first H1, or at the very top.
Example
Given a document whose headings are # Project Handbook, ## Getting Started,
### Prerequisites, ### Installation, and ## Architecture, selecting levels
H2 to H3 with dash bullets produces:
## Table of Contents
- [Getting Started](#getting-started)
- [Prerequisites](#prerequisites)
- [Installation](#installation)
- [Architecture](#architecture)
Switch the style to numbered and the same headings render as 1., 1., 2.
nested lists; switch to keep-words slugs and the anchors preserve the original
casing. Because every figure is derived from your text in real time, you can
experiment with depth and style and watch the outline reshape instantly. Nothing
is uploaded — the whole tool runs in your browser.