Pre-existing bugs found while reviewing #151
维护者通常 1 天内回复
还没有人认领这个 Issue。
评估
调研方向
The five bugs sit in gh-md-toc: the HTTP status check in gh_toc_load (around L38), the stdin read loop (L421-425), the error output (L160-171), and the single-line sed in gh_toc_grab (L290). The issue says to wait for #151, which changes the stdin block and error output, so check that PR first. Done means each checkbox is fixed and reproduced on both Linux and macOS, with the issue's examples giving the expected output.
由索引模型根据 Issue 内容生成。
描述
Found while reviewing #151. All of these reproduce on current master (9e0a858), #151 doesn't introduce them. Line numbers refer to gh-md-toc at 9e0a858.
- Remote URL ignores the HTTP status (
gh_toc_load, L38).curl -sonly fails on network errors, so./gh-md-toc https://github.com/ekalinin/github-markdown-toc/blob/master/NOPE-404.mdprints an empty TOC and exits 0. - stdin input is changed before it is sent (L423-425).
while read -r input; do echo "$input" >> ...strips leading whitespace, drops a last line without a trailing newline, andechoswallows lines like-n. Forprintf '# A\n\n # indented code\n-n\n# Last' | ./gh-md-toc -the API gets only# A, an empty line and# indented code, so the indented code block becomes a heading and# Lastis lost.cat > "$gh_tmp_md"would keep the input as is. - The stdin temp file is never removed (L421). Every
gh-md-toc -run leaves atmp.XXXXXXfile with the input markdown in$TMPDIR. - Errors go to stdout (L160-171). The network and rate-limit errors are printed with plain
echo, so./gh-md-toc README.md > toc.mdwrites the error text intotoc.mdunder the "Table of Contents" header. The exit code is 1, but the error ends up in the output file. - The rate-limit hint always points to
token.txt(L168-169). It's printed even whenGH_TOC_TOKENis set, and in that casetoken.txtis ignored. - Single-line HTML gives an empty TOC on macOS (
gh_toc_grab, L290). BSD sed'sNon the last line quits without printing, sosed -e ':a' -e 'N' -e '$!ba' ...outputs nothing for one-line input. A document with only one heading renders to one line of HTML, soprintf '# A\n' | ./gh-md-toc -prints an empty TOC on macOS, whileprintf '# A\n\n## B\n'works.
#151 changes the stdin block and the error output, so it's easier to fix these after it's merged.
- 主要语言
- Shell
- 星标
- 3.3k
- 派生
- 2.7k
- 平均合并
- 1 小时 7 分钟
- 30 天内合并 PR
- 9
环境准备
- 提供 Dockerfile 或 Docker Compose 文件
- 没有 Pull Request 模板
- 没有贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
ekalinin/github-markdown-toc 的其他 Issue
-
难度 1/5 1-3 小时 新手友好度 78/100
ekalinin/github-markdown-toc#176 ·
维护者通常 1 天内回复
-
Update outdated examples and versions in README可能已有人在做 @SatvikMishra08 于 19 天前认领。 未关闭documentation
难度 2/5 1-3 小时 新手友好度 88/100
ekalinin/github-markdown-toc#165 ·
维护者通常 1 天内回复
-
[Feature] `--no-code-tag-removal` flag allowing to make removal of backticks in TOC entries optional可能已有人在做 @jofas 于 803 天前认领。 未关闭enhancement
难度 3/5 1-2 天 新手友好度 58/100
ekalinin/github-markdown-toc#153 ·
维护者通常 1 天内回复
-
难度 3/5 1-2 天 新手友好度 35/100
ekalinin/github-markdown-toc#152 · 1 个 reaction ·
维护者通常 1 天内回复
-
bug
难度 3/5 1-2 天 新手友好度 35/100
ekalinin/github-markdown-toc#141 ·
维护者通常 1 天内回复
查看 ekalinin/github-markdown-toc 的全部 Issue
相似的 Issue
-
area: compat area: parsing bug
难度 2/5 1-3 小时 新手友好度 72/100
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 72/100
Micke-K/IntuneManagement#441 ·
-
review-2026-10 Trad En
难度 2/5 半天 新手友好度 70/100
zigbeefordomoticz/wiki#302 ·
-
refactoring
难度 2/5 1-3 小时 新手友好度 66/100
UnionInternationalCheminsdeFer/OSDM#1647 ·
维护者通常 1 天内回复
-
Add dependabot未关闭feat
难度 2/5 1 小时以内 新手友好度 72/100
open-nudge/opentemplate#204 ·
维护者通常 1 天内回复