[ BUG ] TOC entry text keeps the HTML of links, images and formatting in a heading
还没有人认领这个 Issue。
评估
调研方向
issue 指向 internal/utils/utils.go 和 internal/adapters/tocgrabber_re.go;先阅读 Utils.RemoveStuff 和 RegexpExtractor.Extract,然后将原始 URL 输出与预期示例进行比较。完成标准是:TOC 条目文本去除 HTML 标签,同时保留标签内部文本和现有的已渲染实体,且不更改锚点。根据 issue,blob URL 路径不受影响。
由索引模型根据 Issue 内容生成。
描述
Describe the bug
For a local file, STDIN or a raw URL, the text of a TOC entry is the HTML that GitHub
renders for the heading, with only <code> removed. A heading with a link, an image,
emphasis or inline HTML gives an entry with tags in its text. The anchors are correct.
The Bash version had the same bug (ekalinin/github-markdown-toc#40,
ekalinin/github-markdown-toc#67) and fixed it in ekalinin/github-markdown-toc#185.
To Reproduce
The test file of the Bash version:
gh-md-toc --hide-header --hide-footer "https://raw.githubusercontent.com/ekalinin/github-markdown-toc/master/tests/test%20directory/test_headingmarkup.md"
Actual:
* [Top](#top)
* [On <sub><sub><a href="\#top">Go to Top</a></sub></sub>](#on-go-to-top)
* [<a href="https://github\.com/ekalinin/github\-markdown\-toc/issues/67">My issue</a>](#my-issue)
* [See <a href="\#top">docs</a> here](#see-docs-here)
* [Linux vs\. Samba <em><strong>permissions</strong></em>](#linux-vs-samba-permissions)
* [A <a target="\_blank" rel="noopener noreferrer" href="x\.png"><img src="x\.png" alt="img" style="max\-width: 100%;"></a> B](#a--b)
* [Tom & Jerry <3](#tom--jerry-3)
Expected behavior
All HTML tags are removed, the text inside them is kept, and HTML entities stay as GitHub
renders them, as in the Bash version:
* [Top](#top)
* [On Go to Top](#on-go-to-top)
* [My issue](#my-issue)
* [See docs here](#see-docs-here)
* [Linux vs\. Samba permissions](#linux-vs-samba-permissions)
* [A B](#a--b)
* [Tom & Jerry <3](#tom--jerry-3)
Environment (please complete the following information):
- OS: macOS (darwin/arm64)
- Version: 2.0.1, current
master(dd680f7)
Additional context
utils.RemoveStuff(internal/utils/utils.go) removes only<code>and</code>. It
is applied to the heading text inRegexpExtractor.Extract
(internal/adapters/tocgrabber_re.go).- The blob URL of the same file is not affected: its text comes from the JSON payload
(JSONExtractor).
- 主要语言
- Go
- 星标
- 525
- 派生
- 89
- 平均合并
- 6 分钟
- 30 天内合并 PR
- 1
环境准备
- 提供 Dockerfile 或 Docker Compose 文件
- 没有 Pull Request 模板
- 没有贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
ekalinin/github-markdown-toc.go 的其他 Issue
-
bug
难度 2/5 1-3 小时 新手友好度 80/100
-
bug
难度 2/5 1-3 小时 新手友好度 84/100
-
enhancement
难度 3/5 1-2 天 新手友好度 65/100
-
enhancement
难度 4/5 3-5 天 新手友好度 45/100
-
enhancement
难度 4/5 3-5 天 新手友好度 55/100
查看 ekalinin/github-markdown-toc.go 的全部 Issue
相似的 Issue
-
/shutdown/ready can fail to return an HTTP response when readiness takes longer than the server write timeout可能已有人在做 @floriankoch 今天认领。 未关闭triage
难度 2/5 1-3 小时 新手友好度 76/100
envoyproxy/gateway#10562 ·
维护者通常 1 天内回复
-
Adding an LDAP group reports every search failure as "LDAP Group DN is not found"可能已有人在做 @Daksha1611 今天认领。 未关闭
难度 2/5 1-3 小时 新手友好度 76/100
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 70/100
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 75/100
-
[Bug] K8s reconcile still resets explicit 0 to defaults for response_api, memory and flow state可能已有人在做 @Bevisy 今天认领。 未关闭needs-acceptance
难度 2/5 1-3 小时 新手友好度 87/100
vllm-project/semantic-router#5998 ·
维护者通常 2 天内回复