Skip to main content
NyankoTools

Markdown Table of Contents Generator

Paste the Markdown of your README or docs and get a table of contents as a Markdown list. Links use GitHub-style anchors, and "#" lines inside code blocks are not treated as headings. To see how the document renders, use the Markdown Preview.

🔒 Runs in your browser · Your data is never sent to a server

How to use

  1. Paste your document into the "Markdown" field.
  2. Choose the depth with "Top heading level to include" and "Bottom heading level to include".
  3. Pick a "List style" and other options, then press "Copy TOC".

Notes

  • Headings are detected in ATX form (lines starting with "#") and Setext form (underlined with === or ---). Fenced code blocks (``` or ~~~) and front matter are skipped.
  • Anchors follow the GitHub rule: lowercase, punctuation removed, spaces turned into "-". Repeated headings get a numeric suffix (-1, -2 and so on). Other platforms such as GitLab may differ slightly.
  • Links, code and emphasis inside a heading are reduced to plain text in the TOC. Headings written as HTML (like <h2>) are not detected.
  • Numbered lists use at least a 3-space indent so nesting renders correctly.

Glossary

Anchor

The part after "#" in a URL that jumps to a spot on the page. GitHub builds it from the heading text, and the TOC links point to these names.

Setext heading

A heading written with a line of "===" or "---" under the text. It can only express levels 1 and 2.

Front matter

A block of metadata (YAML) fenced by "---" at the top of a file, used by static site generators. It is not part of the document headings.

FAQ

Why do the TOC links not jump correctly on GitHub?

Anchors are built from the heading text, so renaming a heading after generating the TOC breaks the link. Regenerate the TOC after editing headings. Platforms other than GitHub, such as GitLab, can use slightly different rules.

What happens when several headings share the same name?

The second and later ones get "-1", "-2" and so on. Headings outside your chosen depth are still counted, so the anchors match what GitHub actually generates.

Are "#" lines inside code blocks treated as headings?

No. Anything inside ``` or ~~~ fences, and front matter at the top of the file, is ignored, so shell comments never leak into the table of contents.

Do non-English headings get anchors too?

Yes. Letters from any language are kept in the anchor and only punctuation is dropped. For example, "使い方 (Usage)" becomes "#使い方-usage".

Share this page

↑↓ Select Enter Open Esc Close