About markdown toc generator
Create a table of contents for a Markdown document from its headings, with GitHub-style links.
How anchors work
GitHub turns a heading into a link by lowercasing it, removing punctuation and replacing spaces with hyphens. Repeated headings get -1, -2 and so on.
A worked example
A document with sections 'Install', 'Usage' and 'Usage > Options' gets a list where each entry links to an anchor such as #install and #options. Paste it near the top of the README so that readers can jump to the part they need.
Keep it accurate
- Regenerate it whenever you rename or add headings.
- Two headings with the same text get a numeric suffix in their anchors.
- Limit the depth to two or three levels for readability.
Where it goes
Place the contents list after the introduction. Some platforms, such as GitLab, generate a table of contents with a special tag, so check your platform before using a manual list.
