consolelog.tools

Markdown TOC Generator

Generate a table of contents from markdown headings — supports depth filtering, ordered lists, and inline insertion

About this ToolHow it works, benefits & use cases

Paste a Markdown document and this tool reads its headings to build a linked table of contents. It recognizes both ATX headings (# through ######) and Setext headings (text underlined with === or ---), then turns each into a bullet that links to a GitHub-style anchor — lowercased, with punctuation stripped and spaces hyphenated. Nesting is preserved: deeper headings are indented relative to the shallowest level found. You control the range with Minimum and Maximum depth selectors (H1–H6), can switch between a bulleted or numbered (1.) list, and can skip the first heading so a document title is not duplicated in its own TOC. Duplicate headings get unique anchors (-2, -3, …) so links never collide. You get two outputs: the standalone TOC on its own, and the complete document with a "## Table of Contents" section inserted either at the very top or right after the title.

How to Use

  1. 1Paste your Markdown into the input panel, or click Load example to try the demo document.
  2. 2Set Minimum depth and Maximum depth to choose which heading levels (H1–H6) appear.
  3. 3Toggle "Use ordered list" for a numbered TOC, and "Skip first header" to omit the document title.
  4. 4Pick an Insert position — After title or At the top — for the embedded TOC.
  5. 5Click Generate TOC to produce the standalone list and the full document with the TOC inserted.
  6. 6Copy or download either output, or pipe the standalone TOC into another tool.

Key Benefits

  • Detects both ATX (#) and Setext (underline) headings
  • GitHub-compatible anchor slugs generated from each heading
  • Depth filtering with independent minimum and maximum (H1–H6)
  • Ordered (1.) or unordered (-) list output, your choice
  • Skip-first-header option avoids duplicating the document title
  • Duplicate headings get unique, collision-free anchors automatically
  • Outputs both a standalone TOC and the full document with the TOC inserted

Common Use Cases

  • Adding a navigable table of contents to a long README before pushing to GitHub
  • Generating section links for documentation pages and wiki articles
  • Trimming a TOC to only H2/H3 by setting the depth range
  • Producing a numbered outline of a spec or design doc
  • Refreshing the TOC after restructuring a document’s headings

TOC options

Run to see the generated table of contents.

Was this tool helpful?

Share Your Experience

Help others discover this tool!

Related tools