Add a table of contents to a Markdown doc

A long README needs navigation. Generate a nested TOC with GitHub-style anchors — and update it when headings change.

Tools used in this guide

The job

READMEs grow past the point where scrolling works. A linked TOC at the top keeps readers oriented — but hand-written TOCs rot the moment a heading is renamed.

Generate it

Paste the doc, pick the heading range (H2–H4 is typical for READMEs), and run. The tool extracts headings — skipping any inside fenced code blocks — and emits a nested list with GitHub-style anchors: lowercase, spaces→dashes, punctuation dropped, duplicates suffixed -1, -2.

  • Ordered option emits '1.' items; plain emits a no-link outline.
  • H1 is usually the doc title — start at H2 for a contents list.

Worked example

A doc with '## Getting Started', '### Docker setup', '## API Reference' produces: - [Getting Started](#getting-started) - [Docker setup](#docker-setup) - [API Reference](#api-reference) Paste it under the title and the links navigate on GitHub as soon as it's pushed.

Limits

Anchors follow GitHub's algorithm — other renderers (GitLab, mdBook) differ slightly on punctuation handling. Up to 300,000 characters / 500 headings. Regenerate after heading edits; it does not auto-sync.