[ BUG ] Headings are missing from the TOC when GitHub puts a line break after the heading tag
Los mantenedores suelen responder en 1 día
Nadie ha tomado este issue todavía.
Evaluación
- Dificultad
- 2/5
- Tiempo estimado
- 1-3 horas
- Aptitud para principiantes
- 78/100
Línea de trabajo
Empieza con gh_toc_grab en gh-md-toc, que, según indica el issue, une las líneas seleccionadas antes de buscar encabezados con grep. Reproduce el problema usando el ejemplo test.md proporcionado y comprueba después que los encabezados con enlaces o código en línea se incluyan en el TOC tanto para un archivo local como para stdin. La tarea está terminada cuando aparecen las tres entradas esperadas en orden.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
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.
- Lenguaje dominante
- Shell
- Estrellas
- 3.3k
- Forks
- 2.7k
- Merge medio
- 1 h 56 min
- PR fusionados (30 d)
- 21
Preparar el entorno
- Incluye un Dockerfile o un archivo de Docker Compose
- Sin plantilla de pull request
- Sin guía de contribución
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Más de ekalinin/github-markdown-toc
-
bug
Dificultad 2/5 1-3 horas Aptitud para principiantes 82/100
ekalinin/github-markdown-toc#204 ·
Los mantenedores suelen responder en 1 día
-
Update bats version in CIAbiertoenhancement
Dificultad 1/5 1-3 horas Aptitud para principiantes 78/100
ekalinin/github-markdown-toc#176 ·
Los mantenedores suelen responder en 1 día
-
Update outdated examples and versions in READMEPosiblemente ocupada @SatvikMishra08 la tomó hace 42 días. Abiertodocumentation
Dificultad 2/5 1-3 horas Aptitud para principiantes 88/100
ekalinin/github-markdown-toc#165 ·
Los mantenedores suelen responder en 1 día
-
bug
Dificultad 3/5 1-2 días Aptitud para principiantes 76/100
ekalinin/github-markdown-toc#203 ·
Los mantenedores suelen responder en 1 día
-
bug
Dificultad 3/5 1-2 días Aptitud para principiantes 70/100
ekalinin/github-markdown-toc#194 ·
Los mantenedores suelen responder en 1 día
Todos los issues de ekalinin/github-markdown-toc
Issues similares
-
flac's CMake config is brokenAbiertobug
Dificultad 2/5 1-3 horas Aptitud para principiantes 68/100
msys2/MINGW-packages#33356 · 1 comentario ·
Los mantenedores suelen responder en 1 día
-
Misleading 'Update → Config → Hyprland' menu item silently resets user configs without confirmationAbierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 72/100
Los mantenedores suelen responder en 1 día
-
Dificultad 1/5 1-3 horas Aptitud para principiantes 88/100
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
kunchenguid/headless#23 ·
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
mack-a/v2ray-agent#1370 ·