为什么用这个工具
03Markdown toc 生成器在浏览器本地运行,适合快速处理与复制结果。
Markdown toc 生成器适用于日常高频小任务,打开即用。
默认本地处理,便于快速检查与复制结果。
如何使用
02复制前快速检查
03先确认输入格式符合你的预期。
在把结果用于文档、链接、配置或消息前快速扫一眼。
只复制你真正需要的输出。
使用场景
READMEs over a few screens benefit from a top-of-file TOC. Paste your full README in, copy the output, and paste it after the intro. Use the GitHub anchor style if the README lives on GitHub.
Many static-site generators (Docusaurus, Nextra, MkDocs) consume Markdown with anchor links. Use this tool to pre-generate the TOC instead of relying on the framework's auto-TOC plugin if you want manual control.
Long internal design docs benefit from a navigable TOC. The depth cap means you can show top-level sections only (H2) or include sub-sections for fine-grained navigation.
GitHub, GitLab, and other Markdown renderers have slightly different slugify rules. When porting docs between systems, regenerate the TOC with the matching anchor style so links don't break.
Generating the TOC is a fast way to see if your headings flow logically. A TOC with too-deep nesting, repeated section names, or missing H2-level sections usually signals an organization problem worth fixing.
使用技巧
- 01Duplicate headings auto-deduplicate the slug
If you have two sections with the same title (e.g., "Examples"), the second one gets <code>-1</code> appended to its slug to keep links unique. This matches GitHub and most other Markdown processors' behavior.
- 02Code blocks are ignored
Lines that look like headings inside <code>```</code>-fenced code blocks (e.g., a shell prompt that includes a hash) are correctly excluded from the TOC.
- 03Indent reflects relative depth, not absolute
If your document starts at H2 (no H1, or H1 skipped), H2 sits flush-left in the output. The TOC tree's root is whichever level is shallowest in your filtered headings.
- 04Plain slug style strips non-ASCII characters
GitHub's slugify keeps Unicode letters (so a Chinese or Korean heading produces a usable slug). The plain style strips everything outside ASCII for maximum compatibility with older Markdown renderers.
常见问题
01
这个工具会上传数据吗?
默认在浏览器本地处理。