AI Agent Hub
Back to skills
Markdown TOC Generator icon

Markdown TOC Generator

Development Updated 2026.08.30

Paste the following prompt into your AI chat to install this skill:

Please install @user_15292d5a/yjkj-markdown-toc using https://skillhub.cn/install/skillhub.md.

About this skill

Problem: Long Markdown Needs a Reliable TOC

When a Markdown document grows from a few lines to hundreds, headings from # to ###### are scattered through the body. Readers struggle to navigate, and authors maintain a table of contents by hand. Duplicates, inline formatting, and code blocks make simple regex-based TOC generation error-prone.

How It Works

markdown-toc extracts Markdown headings and produces an insertable table of contents. Key capabilities:
- Detects levels 1-6 (# through ######);
- Supports bullet-list and linked TOC formats;
- Allows configurable heading-level filtering;
- Generates unique anchors for duplicate headings;
- Preserves bold, italic, and inline code in heading text;
- Skips heading-like lines inside code blocks.

Boundaries

It targets documents that already use standard Markdown headings. It does not restructure content or repair nonstandard titles. If heading levels or section names are inconsistent, the generated TOC remains only as readable as the source document.

Use Cases

  • Generate a 1-3 level heading TOC for a long API design doc so reviewers can jump to sections.
  • Create a linked TOC for an ops manual with repeated subsection names and stable unique anchors.
  • Filter lower-level headings in a technical post to keep only major sections in a compact list TOC.
  • Preserve bold, italic, and inline code in tutorial headings so the generated TOC text stays accurate.

Best For

  • Engineering docs owners maintaining internal wikis who need clickable TOCs for long pages.
  • Technical blog authors who want to insert a heading-based TOC into Markdown drafts quickly.
  • API manual developers who need section-level link TOCs for review and navigation.
  • Ops documentation teams who need repeated headings resolved into stable unique anchors.