Polysh for agents is in early access. Your coding agent records the demo, and Polysh finishes it. Join the waitlist →

Markdown TOC Generator

Get a clickable, nested table of contents for any Markdown document.

Loading your browser tool…

What Markdown TOC Generator does

A long README, SOP or admin guide needs a contents list near the top, and keeping one in sync by hand is easy to get wrong. Paste the whole document and the generator reads every heading, including underlined === and --- headings, then writes a nested list of links that jump to each section.

Choose how deep to go with Include down to, from H2 only to every level. A single H1 title is left out by default, since it usually names the document itself. Turn on Numbered contents for a 1., 2., 3. outline, which doubles as a quick heading map when you restructure a doc.

Example

Input

# Recorder handbook

## Before you record
### Mic check (2 min)
## Editing
### Trim pauses
## Editing
#### Keyboard shortcuts

Result

- [Before you record](#before-you-record)
  - [Mic check (2 min)](#mic-check-2-min)
- [Editing](#editing)
  - [Trim pauses](#trim-pauses)
- [Editing](#editing-1)

The H1 title is skipped, the H4 sits below the default H3 depth, the parentheses vanish from the anchor, and the second Editing heading links to #editing-1.

How to use Markdown TOC Generator

  1. Paste the full Markdown document, or click Open file to load a .md file.
  2. Pick a level under Include down to; More options has Leave out a single H1 title and Numbered contents.
  3. Click Copy, or Download .md, and paste the list under your document's title.

Good to know

  • GitLab, Bitbucket, Docusaurus and other renderers may build ids differently from GitHub for headings with punctuation or non-Latin letters, so test a couple of links there.
  • Headings inside fenced code are ignored, as they should be, but headings written as raw HTML such as <h2> are not picked up either.
  • The list is a snapshot. When you rename or add headings, generate it again; nothing keeps it updated.

Questions about Markdown TOC Generator

How do I add a table of contents to a GitHub README?

Paste the README here, copy the generated list, and paste it under the title. Each entry links to an anchor GitHub creates for that heading. GitHub also has an outline menu for README files, but an in-file list works in every viewer.

Why doesn't a TOC link jump to its heading?

Usually the heading changed after the list was made, or your site builds anchors differently from GitHub. Regenerate the list from the current text, and compare one anchor with the id your site actually puts on that heading.

Should a table of contents include H4 headings?

Usually not. Readers scan H2 sections, and H3 adds enough detail for long guides. Going deeper makes the list longer than the content it summarizes, so keep the default H3 and pick H4 or All only for reference docs.

Can I number the table of contents?

Yes. Turn on Numbered contents under More options. Each level is numbered from 1 and indented three spaces, so it renders as a nested ordered list.