[ BUG ] --insert and --stdout fill every <!--ts--> / <!--te--> pair, also in code blocks
Maintainer thường phản hồi trong vòng 1 ngày
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 3/5
- Thời gian dự kiến
- 1-2 ngày
- Mức phù hợp với người mới
- 70/100
- Loại issue
- Lỗi
- Độ rõ ràng
- Đặc tả rõ ràng
- Mức độ hoạt động
- Sôi nổi
- Công nghệ
- bash, markdown, shell
- Lĩnh vực
- cli, documentation
Hướng nghiên cứu
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.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
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.
- Ngôn ngữ chính
- Shell
- Star
- 3.3k
- Fork
- 2.7k
- Merge trung bình
- 1 giờ 56 phút
- Pull request đã merge (30 ngày)
- 21
Chuẩn bị môi trường
- Có Dockerfile hoặc tệp Docker Compose
- Không có mẫu pull request
- Không có hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của ekalinin/github-markdown-toc
-
bug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 82/100
ekalinin/github-markdown-toc#204 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
[ BUG ] Headings are missing from the TOC when GitHub puts a line break after the heading tagĐang mởbug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
ekalinin/github-markdown-toc#201 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Update bats version in CIĐang mởenhancement
Độ khó 1/5 1-3 giờ Mức phù hợp với người mới 78/100
ekalinin/github-markdown-toc#176 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Update outdated examples and versions in READMECó thể đã có người làm @SatvikMishra08 đã nhận 42 ngày trước. Đang mởdocumentation
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 88/100
ekalinin/github-markdown-toc#165 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
bug
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 76/100
ekalinin/github-markdown-toc#203 ·
Maintainer thường phản hồi trong vòng 1 ngày
Tất cả issue của ekalinin/github-markdown-toc
Issue tương tự
-
flac's CMake config is brokenĐang mởbug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 68/100
msys2/MINGW-packages#33356 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Misleading 'Update → Config → Hyprland' menu item silently resets user configs without confirmationĐang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 1/5 1-3 giờ Mức phù hợp với người mới 88/100
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
kunchenguid/headless#23 ·
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
mack-a/v2ray-agent#1370 ·