[ BUG ] --insert and --stdout fill every <!--ts--> / <!--te--> pair, also in code blocks
Maintainer antworten meist innerhalb von 1 Tag
Dieses Issue hat noch niemand übernommen.
Bewertung
- Schwierigkeit
- 3/5
- Geschätzter Aufwand
- 1-2 Tage
- Anfängerfreundlichkeit
- 70/100
- Issue-Typ
- Bug
- Klarheit
- Klar beschrieben
- Aktivitätsstatus
- Aktiv
- Tech-Stack
- bash, markdown, shell
- Bereich
- cli, documentation
Rechercherichtung
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.
Vom Indexierungsmodell aus dem Issue-Text verfasst.
Beschreibung
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.
- Vorherrschende Sprache
- Shell
- Sterne
- 3.3k
- Forks
- 2.7k
- Ø Merge
- 1 Std. 56 Min.
- Gemergte PRs (30 T.)
- 21
Entwicklungsumgebung
- Enthält ein Dockerfile oder eine Docker-Compose-Datei
- Keine Pull-Request-Vorlage
- Kein Beitragsleitfaden
Erste Schritte
- Lesen Sie das ganze Issue und danach den Beitragsleitfaden des Projekts.
- Schreiben Sie ins Issue, dass Sie es übernehmen — das erspart doppelte Arbeit.
- Forken Sie das Repository und arbeiten Sie in einem Branch.
- Öffnen Sie einen Pull Request, der die Issue-Nummer nennt.
Mehr aus ekalinin/github-markdown-toc
-
bug
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 82/100
ekalinin/github-markdown-toc#204 ·
Maintainer antworten meist innerhalb von 1 Tag
-
bug
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 78/100
ekalinin/github-markdown-toc#201 ·
Maintainer antworten meist innerhalb von 1 Tag
-
enhancement
Schwierigkeit 1/5 1-3 Stunden Anfängerfreundlichkeit 78/100
ekalinin/github-markdown-toc#176 ·
Maintainer antworten meist innerhalb von 1 Tag
-
Update outdated examples and versions in READMEEvtl. vergeben @SatvikMishra08 hat das vor 42 Tagen übernommen. Offendocumentation
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 88/100
ekalinin/github-markdown-toc#165 ·
Maintainer antworten meist innerhalb von 1 Tag
-
bug
Schwierigkeit 3/5 1-2 Tage Anfängerfreundlichkeit 76/100
ekalinin/github-markdown-toc#203 ·
Maintainer antworten meist innerhalb von 1 Tag
Alle Issues in ekalinin/github-markdown-toc
Ähnliche Issues
-
bug
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 68/100
msys2/MINGW-packages#33356 · 1 Kommentar ·
Maintainer antworten meist innerhalb von 1 Tag
-
Misleading 'Update → Config → Hyprland' menu item silently resets user configs without confirmationOffen
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 72/100
Maintainer antworten meist innerhalb von 1 Tag
-
Schwierigkeit 1/5 1-3 Stunden Anfängerfreundlichkeit 88/100
-
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 78/100
kunchenguid/headless#23 ·
-
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 78/100
mack-a/v2ray-agent#1370 ·