[Feature] Bullet character: --bullet *|-|+
还没有人认领这个 Issue。
评估
调研方向
Start with flag handling in cmd/gh-md-toc/config.go, then follow the configuration into coretoc.Config and Renderer.Render in internal/core/toc/renderer.go. Check the existing flag and renderer tests, and README.md for documentation conventions. Done means --bullet accepts *, - or + across the stated input modes, rejects invalid combinations, and keeps the default output unchanged.
由索引模型根据 Issue 内容生成。
描述
Is your feature request related to a problem? Please describe.
Every TOC entry starts with *, and there is no way to use another bullet, for example
a dash. The marker is hardcoded in internal/core/toc/renderer.go
(indent+"* ["+text+"]("+link+")"). The same request for the Bash version is
ekalinin/github-markdown-toc#71, and it is implemented there in
ekalinin/github-markdown-toc#182.
Describe the solution you'd like
The same option as in the Bash version: --bullet <CHAR> with *, - or + (the
three bullet markers of CommonMark), which starts every entry with that character:
- [Title one](#title-one)
- [Section](#section)
- [Title two](#title-two)
Behavior in the Bash version:
- The default stays
*, so without--bulletthe output does not change. - The bullet applies to stdin, local files, remote URLs, several inputs and
--insert. - An unknown character is an error with exit code 1, before any network call.
--bulletwith--numbered listis an error: an ordered list has no bullet.
With--numbered outlinethe bullet replaces*:- [2.1. Section](#section).
Describe alternatives you've considered
- Replace the marker after generation:
gh-md-toc README.md | sed 's/^\( *\)\* \[/\1- [/'. It does not work with
--insert, which writes the TOC into the file directly.
Additional context
--numberedis not implemented here yet (#92). The two--numberedrules above apply
to whichever of the two options lands second.- Places to change, as for the other flags: the flag in
cmd/gh-md-toc/config.go, a new
field incoretoc.Config(default*), and the marker inRenderer.Render. Plus
tests andREADME.md.
- 主要语言
- Go
- 星标
- 525
- 派生
- 89
- 平均合并
- 6 分钟
- 30 天内合并 PR
- 1
环境准备
- 提供 Dockerfile 或 Docker Compose 文件
- 没有 Pull Request 模板
- 没有贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
ekalinin/github-markdown-toc.go 的其他 Issue
-
enhancement
难度 4/5 3-5 天 新手友好度 62/100
-
bug
难度 3/5 1-2 天 新手友好度 58/100
-
enhancement
难度 5/5 一周以上 新手友好度 25/100
-
bug
难度 2/5 1-3 小时 新手友好度 45/100
查看 ekalinin/github-markdown-toc.go 的全部 Issue
相似的 Issue
-
难度 2/5 1-3 小时 新手友好度 78/100
-
难度 2/5 1-3 小时 新手友好度 78/100
router-for-me/CLIProxyAPI#7330 ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 78/100
维护者通常 1 天内回复
-
bug os:ios
难度 2/5 1-3 小时 新手友好度 72/100
hajimehoshi/ebiten#4039 · 2 条评论 ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 65/100
维护者通常 9 天内回复