Markdown Table of Contents Generator
Parse markdown documents and generate a clean, clickable Table of Contents (TOC) with GitHub-compliant anchor links in seconds.
Markdown Document
Generated Table of Contents
TOC preview will appear here...
Why Add a Table of Contents to Markdown Documents?
Long documentation files, open-source GitHub README.md files, technical specifications, and wiki articles can quickly stretch across hundreds of lines of code.
Adding a structured Table of Contents (TOC) provides visitors with an instant overview of the project architecture and allows them to jump directly to installation instructions, configuration tables, or API references with a single click.
How GitHub Anchor Links Work
GitHub, GitLab, and most Markdown parsers (like CommonMark) automatically convert headings into anchor tags following strict slugification rules:
- Lowercasing: All uppercase letters are converted to lowercase (
# Getting Startedbecomes#getting-started). - Whitespace replacement: Spaces and tabs are replaced with hyphens (
-). - Punctuation stripping: Colons, slashes, periods, exclamation marks, and question marks are completely removed.
- Duplicate handling: Identical headings receive sequential numbering (e.g.,
#example,#example-1,#example-2).
Frequently Asked Questions (FAQ)
# H1 heading typically represents the title of the repository or article itself. Including it in the Table of Contents creates redundant clutter because the reader is already at the top of the page.