[ BUG ] --insert and --stdout fill every <!--ts--> / <!--te--> pair, also in code blocks
メンテナーはふだん 1 日以内に返信
まだ誰も着手していません。
評価
- 難易度
- 3/5
- 見積もり時間
- 1〜2日
- 初心者へのやさしさ
- 70/100
- issue の種類
- バグ
- 明瞭さ
- 明確に書かれている
- 活発さ
- 活発
- 技術スタック
- bash, markdown, shell
- 領域
- cli, documentation
調査の方向性
Start with the marker check and the two sed edits described in the issue, then reproduce the behavior with the provided test.md example and --stdout. Compare the output with the expected behavior: marker pairs inside fenced code blocks should remain unchanged. Check --insert --no-backup on a copy of the README as well; done means both modes update the intended TOC while preserving the examples.
索引モデルが issue の本文から書いたものです。
説明
Describe the bug
--insert and --stdout put the TOC between every <!--ts--> / <!--te--> pair in the file. Marker lines inside fenced code blocks count too, so examples that show the markers are overwritten.
The marker check (grep -Fxq "<!--ts-->") only tests that a marker line exists. The edit (sed "/<\!--ts-->/,/<\!--te-->/{//!d;}", then sed "/<\!--ts-->/r ...") runs on every line that has a marker.
To Reproduce
printf '<!--ts-->\n<!--te-->\n\n# Title\n\nPut these lines into a file:\n\n```\n<!--ts-->\n<!--te-->\n```\n' > test.md
./gh-md-toc --hide-footer --stdout test.md
Output:
<!--ts-->
* [Title](#title)
<!--te-->
# Title
Put these lines into a file:
```
<!--ts-->
* [Title](#title)
<!--te-->
```
The README of this repository has three pairs: the TOC (lines 31-47) and two examples in code blocks of the "Auto insert and update TOC" section (lines 318-319 and 353-369). ./gh-md-toc --hide-footer --stdout README.md puts the TOC into all three:
- the example "Just put into a file these two lines" gets the whole TOC between its two lines;
- the example output of
grep -A15 "<\!\-\-ts" README.test.mdis replaced with the TOC of README.md.
--insert --no-backup --hide-footer on a copy of README.md gives the same file as --stdout.
Expected behavior
The examples in code blocks stay unchanged.
Environment (please complete the following information):
- OS: macOS (Darwin 24.6.0)
- Version: 0.11.0 (master at 62e6fe4)
Additional context
Found while looking into #119.
- 主要言語
- Shell
- スター
- 3.3k
- フォーク
- 2.7k
- 平均マージ
- 1時間 56分
- マージ済み PR(30日)
- 21
環境構築
- Dockerfile または Docker Compose ファイルあり
- プルリクエストのテンプレートなし
- コントリビューションガイドなし
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
ekalinin/github-markdown-toc のほかの issue
-
bug
難易度 2/5 1〜3時間 初心者へのやさしさ 82/100
ekalinin/github-markdown-toc#204 ·
メンテナーはふだん 1 日以内に返信
-
bug
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
ekalinin/github-markdown-toc#201 ·
メンテナーはふだん 1 日以内に返信
-
enhancement
難易度 1/5 1〜3時間 初心者へのやさしさ 78/100
ekalinin/github-markdown-toc#176 ·
メンテナーはふだん 1 日以内に返信
-
Update outdated examples and versions in README対応中かも @SatvikMishra08 が 42 日前に担当しました。 オープンdocumentation
難易度 2/5 1〜3時間 初心者へのやさしさ 88/100
ekalinin/github-markdown-toc#165 ·
メンテナーはふだん 1 日以内に返信
-
bug
難易度 3/5 1〜2日 初心者へのやさしさ 76/100
ekalinin/github-markdown-toc#203 ·
メンテナーはふだん 1 日以内に返信
ekalinin/github-markdown-toc の issue をすべて見る
似ている issue
-
bug
難易度 2/5 1〜3時間 初心者へのやさしさ 68/100
msys2/MINGW-packages#33356 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
-
Misleading 'Update → Config → Hyprland' menu item silently resets user configs without confirmationオープン
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
メンテナーはふだん 1 日以内に返信
-
難易度 1/5 1〜3時間 初心者へのやさしさ 88/100
-
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
kunchenguid/headless#23 ·
-
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
mack-a/v2ray-agent#1370 ·