mdtoc

package
v0.2.260115 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 15, 2026 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Command = &cli.Command{
	Name:     "mc-mdtoc",
	Usage:    "生成和查看 Markdown 文档的大纲 (TOC)",
	Commands: []*cli.Command{version.Command},
	UsageText: `mc-mdtoc [options] <file>...
fd -e md | mc-mdtoc`,
	Flags: []cli.Flag{
		&cli.IntFlag{
			Name:    "min-level",
			Aliases: []string{"m"},
			Value:   1,
			Usage:   "最小标题层级 (1-6)",
		},
		&cli.IntFlag{
			Name:    "max-level",
			Aliases: []string{"M"},
			Value:   3,
			Usage:   "最大标题层级 (1-6)",
		},
		&cli.BoolFlag{
			Name:    "in-place",
			Aliases: []string{"i"},
			Usage:   "原地更新文件 (在 <!--TOC--> 标记处插入)",
		},
		&cli.BoolFlag{
			Name:    "force",
			Aliases: []string{"f"},
			Usage:   "强制生成 TOC,即使文件中没有 <!--TOC--> 标记",
		},
		&cli.BoolFlag{
			Name:    "delete",
			Aliases: []string{"d"},
			Usage:   "删除文件中的 TOC 标记和内容",
		},
		&cli.BoolFlag{
			Name:    "ordered",
			Aliases: []string{"o"},
			Usage:   "使用有序列表 (1. 2. 3.)",
		},
		&cli.BoolFlag{
			Name:    "line-number",
			Aliases: []string{"L"},
			Value:   true,
			Usage:   "显示行号范围 (:start:end)",
		},
		&cli.BoolFlag{
			Name:    "path",
			Aliases: []string{"p"},
			Usage:   "显示文件路径 (path:start:end)",
		},
		&cli.BoolFlag{
			Name:    "global",
			Aliases: []string{"g"},
			Usage:   "全局模式: 生成完整文档的单一目录 (默认为章节模式)",
		},
		&cli.BoolFlag{
			Name:    "anchor",
			Aliases: []string{"a"},
			Usage:   "预览时显示锚点链接 [标题](#anchor)",
		},
		&cli.StringFlag{
			Name:    "toc-title",
			Aliases: []string{"T"},
			Value:   "Table of Contents",
			Usage:   "TOC 标题 (如 '文档目录',将在 TOC 内生成 ## 文档目录,设为空则不生成标题)",
		},
	},
	Action: action,
}

Command 返回 mc-mdtoc 主命令

Functions

This section is empty.

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL