TOOLGRIDTOOLGRID
首页图片工具PDF 工具视频工具音频工具
More
开发工具Web 与 SEO分类文本工具计算器测试方法关于
Menu
首页图片工具PDF 工具视频工具音频工具开发工具Web 与 SEO分类文本工具计算器测试方法关于
109 个工具已上线
TOOLGRIDTOOLGRID

需要某项具体功能时,完整工具箱始终可用。

© 2026 TOOLGRID. All rights reserved.

Tools

图片工具PDF 工具视频工具音频工具转换工具开发工具Web 与 SEO文本工具计算器

Resources

分类测试方法隐私政策

Company

关于条款联系
文本工具
  1. 首页
  2. Text Tools
  3. Markdown TOC Generator
属于 Text Tools →

Markdown TOC Generator

Generate a Markdown table of contents — GitHub / GitLab / plain slugs, configurable depth, auto-dedup.

开始使用这个工具
浏览器本地处理不向 TOOLGRID 上传输入复制前先检查
TEXT 工作流Markdown TOC Generator 能力卡
输入
Pasted text or typed values
输出
Markdown TOC Generator result
运行引擎
Browser APIs
审核日期
2026-07-17
浏览器本地工作区在下方开始,使用浏览器本地处理。

工具代码会在浏览器中处理所选文件和输入内容,不会将其提交给 TOOLGRID 的处理接口。 TOOLGRID 只衡量工具使用情况,不记录你输入的内容。

  • 不上传工具输入至 TOOLGRID
  • 不登录
  • 复制前先检查

Loading tool…

浏览器内运行

这个工具能做什么

01

In-browser Markdown TOC generator. Extracts headings, generates nested anchor-linked TOC, supports GitHub-compatible slug style.

02

Paste a Markdown document and the tool extracts every #-style heading, generates an anchor slug for each, and emits a nested Markdown list with one entry per heading — properly indented by depth so it renders as a tree.

03

The anchor style toggle matters: GitHub's slugify rules differ slightly from generic Markdown processors. Pick the destination platform so the generated [Title](#slug) links actually navigate when rendered there.

04

Other settings: cap depth at H2/H3/H4/H5/H6 (deeper headings are skipped), and optionally exclude the document's H1 title (most READMEs use H1 as the document title and don't want it in the TOC).

05

Especially useful for README files, technical blog posts, design docs, and internal documentation. Pair with our Markdown Live Preview to see the rendered output, or with Slug Generator if you need to slug a custom title separately.

代表性任务

这个工具适合解决什么问题

Add a TOC to a long README

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.

Generate navigation for a docs site

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.

Build a multi-section design doc index

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.

使用边界

依赖结果前需要检查什么

  • Performance and maximum practical input size depend on browser memory, device speed, and the structure of the input.
  • Review the generated result before replacing or publishing an original file.
MDN Web APIs
继续当前流程下一步常用工具

如果还需要校验、转换或复用结果,可以继续打开相近的浏览器本地工具。

当前结果
产物清理文本动作复制结果
Markdown Live Preview文本工具本地产物清理文本动作复制结果立即本地使用→Slug Generator文本工具本地产物清理文本动作复制结果立即本地使用→字数统计文本工具本地产物清理文本动作复制结果立即本地使用→

如何使用

01
01Pick max heading depth (default H3), anchor style (default GitHub), and whether to skip H1.
02Paste your Markdown document into the input area.
03Copy the generated TOC and paste it at the top of your document (typically right after the title and intro).

使用场景

Add a TOC to a long README

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.

Generate navigation for a docs site

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.

Build a multi-section design doc index

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.

Migrate docs between platforms

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.

Audit document structure

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.

使用技巧

  1. 01
    Duplicate 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.

  2. 02
    Code 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.

  3. 03
    Indent 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.

  4. 04
    Plain 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.

常见问题

02
Does the tool run entirely in my browser?

Parsing and slug generation use browser-side JavaScript. Tool code processes selected files and entered content in your browser and does not submit them to a TOOLGRID processing endpoint. Browser-local processing avoids a TOOLGRID upload path, but it is not a blanket security guarantee.

What anchor styles are supported?

Three: GitHub (default — lowercase, Unicode-preserving, spaces to hyphens, strips most punctuation), GitLab (almost identical to GitHub for typical headings), and Plain (ASCII-only, strict). Pick the one that matches where your Markdown will render.

Why is my generated TOC link broken on GitHub?

Most common causes: (1) the heading text contains characters not in the slug alphabet (emoji, certain Unicode symbols), (2) the document was rendered before the heading was added so GitHub's slug cache is stale (try editing the file), or (3) a slug collision exists higher up the document so this heading's slug got a <code>-1</code> suffix you weren't expecting.

Does it support setext headings (<code>===</code> / <code>---</code>)?

Not currently — only ATX-style <code>#</code>-prefixed headings are recognized. If your document uses setext (underline) syntax, convert to ATX first or paste-and-pre-process.

How does the tool handle headings with inline Markdown (links, code, emphasis)?

The heading text is used verbatim for the link label and as input for the slug. Inline Markdown (<code>**bold**</code>, <code>`code`</code>, <code>[links](url)</code>) is preserved in the label but counts as text characters in the slug. Most renderers handle this correctly; check the rendered output to confirm.

Can I generate TOCs for HTML, AsciiDoc, or reStructuredText?

This tool targets Markdown only. For other formats, look for format-specific TOC generators (Pandoc has TOC generation for many input formats; AsciiDoc has built-in <code>:toc:</code> directive).

Why is the H1 skipped by default?

Most documents use H1 as the document title ("README", "My Project"). Including the title in its own TOC creates a noisy first entry that points back to the top of the page. Toggle it off if your structure uses H1 for sections instead of one document title.

相关工具

03
本地

Markdown Live Preview→立即本地使用No TOOLGRID input upload

Write Markdown and see the rendered HTML update live, then export or print to PDF.

清理文本复制结果

本地

Slug Generator→立即本地使用No TOOLGRID input upload

Create a clean URL slug from a title or phrase.

清理文本复制结果

本地

字数统计→立即本地使用No TOOLGRID input upload

实时统计文本的字数、字符数、句子、段落和行数。

清理文本复制结果