← 返回
未分类 中文

Markdown TOC

Generate a table of contents from Markdown headings with configurable levels, formats, and unique anchors, excluding headings inside code blocks.
根据可配置的层级、格式和唯一锚点,从 Markdown 标题生成目录,排除代码块内的标题。
harrylabsj
未分类 clawhub v1.0.0 1 版本 100000 Key: 无需
★ 0
Stars
📥 343
下载
💾 4
安装
1
版本
#latest

概述

markdown-toc

Generate a Table of Contents (TOC) from Markdown headings.

Description

This skill extracts headings from Markdown files and generates a well-formatted table of contents. It supports standard Markdown heading syntax (#, ##, ###, etc.) and outputs a clean, indented TOC that can be inserted back into your document.

Usage

# Generate TOC from a markdown file
python ~/.openclaw/skills/markdown-toc/markdown_toc.py <input-file> [options]

# Options:
#   --output, -o    Output file (default: stdout)
#   --min-level     Minimum heading level to include (default: 1)
#   --max-level     Maximum heading level to include (default: 6)
#   --format        Output format: "list" or "links" (default: list)

Examples

# Basic usage - print TOC to stdout
python ~/.openclaw/skills/markdown-toc/markdown_toc.py README.md

# Save TOC to a file
python ~/.openclaw/skills/markdown-toc/markdown_toc.py README.md -o toc.md

# Include only level 2-3 headings
python ~/.openclaw/skills/markdown-toc/markdown_toc.py README.md --min-level 2 --max-level 3

# Generate TOC with anchor links
python ~/.openclaw/skills/markdown-toc/markdown_toc.py README.md --format links

Features

  • Extracts headings from # to ###### (levels 1-6)
  • Supports both bullet list and linked TOC formats
  • Configurable heading level filtering
  • Handles duplicate headings with unique anchors
  • Preserves heading text formatting (bold, italic, code)
  • Skips headings inside code blocks

Output Formats

List Format (default)

- Heading 1
  - Heading 2
    - Heading 3

Links Format

- [Heading 1](#heading-1)
  - [Heading 2](#heading-2)
    - [Heading 3](#heading-3)

版本历史

共 1 个版本

  • v1.0.0 当前
    2026-03-31 02:25 安全 安全

安全检测

腾讯云安全 (Keen)

安全,无风险
查看报告

腾讯云安全 (Sanbu)

安全,无风险
查看报告

🔗 相关推荐

productivity

Taobao Shopping

harrylabsj
帮助用户根据公开市场特征决定如何在淘宝购物,随后引导淘宝商品搜索、卖家比较、店铺类型判断等...
★ 0 📥 1,628
content-creation

Content Generator

harrylabsj
跨平台生成并适配基于证据的电商、购物、推荐、社交内容包,适用于产品文案、种草文等需求。
★ 0 📥 1,756
developer-tools

JD Shopping

harrylabsj
京东购物助手,专注信任优先的购买决策,提供安全浏览器辅助购物。用于买京东、查自营、看评论、比价、选规格、判断值不值得买、比较京东与其他平台等场景。
★ 1 📥 1,757