[ BUG ] Headings are missing from the TOC when GitHub puts a line break after the heading tag
Les mainteneurs répondent en général sous 1 jour
Personne n'a encore pris cette issue.
Évaluation
- Difficulté
- 2/5
- Temps estimé
- 1-3 heures
- Accessibilité débutants
- 78/100
Piste de recherche
Commence par gh_toc_grab dans gh-md-toc, qui, selon l’issue, joint les lignes sélectionnées avant une recherche grep des titres. Reproduis le problème à l’aide de l’exemple test.md fourni, puis vérifie que les titres contenant des liens ou du code en ligne sont inclus dans le TOC, aussi bien pour un fichier local que pour stdin. Le travail est terminé lorsque les trois entrées attendues apparaissent dans l’ordre.
Rédigé par le modèle d'indexation à partir du texte de l'issue.
Description
Describe the bug
Some headings are missing from the TOC, without any warning. For these headings the HTML from GitHub has a line break right after the opening heading tag:
<div class="markdown-heading"><h2 class="heading-element">
<a href="https://example.com" rel="nofollow">link</a> here</h2><a id="user-content-link-here" class="anchor" aria-label="Permalink: link here" href="#link-here"><span aria-hidden="true" class="octicon octicon-link"></span></a></div>
gh_toc_grab joins a line with the next one only when the next one starts with </h or <span. So <h2 class="heading-element"> stays on its own line, the heading text and the anchor are on the next line, and grep '<h[1-6][^>]*class="heading-element".*</a' does not find the heading.
To Reproduce
cat > test.md <<'MD'
# Top
## [link](https://example.com) here
## `"q'` and *em*
## Last
MD
./gh-md-toc test.md
Output:
Table of Contents
=================
* [Top](#top)
* [Last](#last)
The HTML from https://api.github.com/markdown/raw for the two missing headings:
<div class="markdown-heading"><h2 class="heading-element">
<a href="https://example.com" rel="nofollow">link</a> here</h2><a id="user-content-link-here" class="anchor" aria-label="Permalink: link here" href="#link-here"><span aria-hidden="true" class="octicon octicon-link"></span></a></div>
<div class="markdown-heading"><h2 class="heading-element">
<code>"q'</code> and <em>em</em>
</h2><a id="user-content-q-and-em" class="anchor" aria-label="Permalink: "q' and em" href="#q-and-em"><span aria-hidden="true" class="octicon octicon-link"></span></a></div>
cat test.md | ./gh-md-toc - gives the same two entries.
Expected behavior
* [Top](#top)
* [link here](#link-here)
* ["q' and em](#q-and-em)
* [Last](#last)
Environment (please complete the following information):
- OS: macOS (Darwin 24.6.0)
- Version: 0.11.0 (master at 34828c5)
Additional context
Found while looking into #153: a heading that starts with inline code can be missing too. Checked with a local file and stdin, not with a remote URL.
- Langage dominant
- Shell
- Étoiles
- 3.3k
- Forks
- 2.7k
- Merge moyen
- 1 h 56 min
- PR mergées (30 j)
- 21
Préparer son environnement
- Fournit un Dockerfile ou un fichier Docker Compose
- Aucun modèle de pull request
- Aucun guide de contribution
Par où commencer
- Lisez l'issue en entier, puis le guide de contribution du projet.
- Signalez en commentaire que vous la prenez — cela évite que deux personnes fassent le même travail.
- Forkez le dépôt et travaillez sur une branche.
- Ouvrez une pull request qui référence le numéro de l'issue.
Autres issues de ekalinin/github-markdown-toc
-
bug
Difficulté 2/5 1-3 heures Accessibilité débutants 82/100
ekalinin/github-markdown-toc#204 ·
Les mainteneurs répondent en général sous 1 jour
-
Update bats version in CIOuverteenhancement
Difficulté 1/5 1-3 heures Accessibilité débutants 78/100
ekalinin/github-markdown-toc#176 ·
Les mainteneurs répondent en général sous 1 jour
-
Update outdated examples and versions in READMEPeut-être pris @SatvikMishra08 l’a pris il y a 42 jours. Ouvertedocumentation
Difficulté 2/5 1-3 heures Accessibilité débutants 88/100
ekalinin/github-markdown-toc#165 ·
Les mainteneurs répondent en général sous 1 jour
-
bug
Difficulté 3/5 1-2 jours Accessibilité débutants 76/100
ekalinin/github-markdown-toc#203 ·
Les mainteneurs répondent en général sous 1 jour
-
bug
Difficulté 3/5 1-2 jours Accessibilité débutants 70/100
ekalinin/github-markdown-toc#194 ·
Les mainteneurs répondent en général sous 1 jour
Toutes les issues de ekalinin/github-markdown-toc
Issues similaires
-
flac's CMake config is brokenOuvertebug
Difficulté 2/5 1-3 heures Accessibilité débutants 68/100
msys2/MINGW-packages#33356 · 1 commentaire ·
Les mainteneurs répondent en général sous 1 jour
-
Misleading 'Update → Config → Hyprland' menu item silently resets user configs without confirmationOuverte
Difficulté 2/5 1-3 heures Accessibilité débutants 72/100
Les mainteneurs répondent en général sous 1 jour
-
Difficulté 1/5 1-3 heures Accessibilité débutants 88/100
-
Difficulté 2/5 1-3 heures Accessibilité débutants 78/100
kunchenguid/headless#23 ·
-
Difficulté 2/5 1-3 heures Accessibilité débutants 78/100
mack-a/v2ray-agent#1370 ·