[ BUG ] TOC entries have no text on OS/390
Mantenedores costumam responder em até 1 dia
Ninguém assumiu esta issue ainda.
Avaliação
- Dificuldade
- 2/5
- Tempo estimado
- 1-3 horas
- Facilidade para iniciantes
- 82/100
Direção de pesquisa
Comece em gh-md-toc, no branch OS/390 de gh_toc_grab, por volta da linha 428, e compare a extração do texto dos títulos com a expressão atualizada do branch padrão. A issue inclui uma reprodução no macOS que força esse branch; execute-a para confirmar os rótulos TOC vazios e, em seguida, verifique se os dois títulos produzem o texto e as âncoras esperados.
Escrita pelo modelo de indexação a partir do texto da issue.
Descrição
Describe the bug
On OS/390 (z/OS) every TOC entry has an empty text: * [](#title) instead of * [Title](#title).
The OS/390 branch of gh_toc_grab takes the heading text with an expression for the old GitHub HTML layout (line 428 on master at a28f86d):
text = substr($0, match($0, /<\/span><\/a>[^<]*<\/h/)+11, RLENGTH-14)
In the old layout the anchor was inside the heading tag, before the text. Now it comes after the heading tag, and the line ends at </a (the grep pattern <h[1-6][^>]*class="heading-element".*</a):
<h1 class="heading-element">gh-md-toc</h1><a id="user-content-gh-md-toc" class="anchor" aria-label="Permalink: gh-md-toc" href="#gh-md-toc"><span aria-hidden="true" class="octicon octicon-link"></span></a
There is no </span></a> followed by the text and </h, so match returns 0 and text is empty. The link is fine: since #185 both branches take it from the class="anchor" element.
7d0a86b ("Update for a new GH HTML layout") changed the grep pattern and the text expression of the default branch to the new layout, but not the text expression of the OS/390 branch.
To Reproduce
Not run on z/OS. Simulated on macOS with a copy of gh-md-toc where the OS/390 branch of gh_toc_grab is always taken, and pcregrep -o is replaced with grep -Eo (the same pattern):
sed -e '422s/if \[ "$(uname -s)" == "OS\/390" \]; then/if true; then/' \
-e '423s/grepcmd="pcregrep -o"/grepcmd="grep -Eo"/' gh-md-toc > os390-gh-md-toc
chmod +x os390-gh-md-toc
printf '# Title\n\n## Section\n' > test.md
./os390-gh-md-toc test.md
Output:
Table of Contents
=================
* [](#title)
* [](#section)
For README.md of this repository, all 17 entries have an empty text.
Expected behavior
* [Title](#title)
* [Section](#section)
Environment (please complete the following information):
- OS: OS/390 (simulated on macOS, Darwin 24.6.0)
- Version: 0.11.0 (master at a28f86d)
Additional context
Found while working on #153 (#202).
- Linguagem predominante
- Shell
- Estrelas
- 3.3k
- Forks
- 2.7k
- Merge médio
- 1h 56min
- PRs com merge (30d)
- 21
Preparar o ambiente
- Inclui um Dockerfile ou arquivo Docker Compose
- Sem modelo de pull request
- Sem guia de contribuição
Primeiros passos
- Leia a issue inteira e depois o guia de contribuição do projeto.
- Comente na issue dizendo que vai assumir — evita que duas pessoas façam o mesmo trabalho.
- Faça um fork do repositório e trabalhe em uma branch.
- Abra um pull request que referencie o número da issue.
Mais de ekalinin/github-markdown-toc
-
[ BUG ] Headings are missing from the TOC when GitHub puts a line break after the heading tagAbertabug
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 78/100
ekalinin/github-markdown-toc#201 ·
Mantenedores costumam responder em até 1 dia
-
Update bats version in CIAbertaenhancement
Dificuldade 1/5 1-3 horas Facilidade para iniciantes 78/100
ekalinin/github-markdown-toc#176 ·
Mantenedores costumam responder em até 1 dia
-
Update outdated examples and versions in READMETalvez já em andamento @SatvikMishra08 assumiu há 42 dias. Abertadocumentation
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 88/100
ekalinin/github-markdown-toc#165 ·
Mantenedores costumam responder em até 1 dia
-
bug
Dificuldade 3/5 1-2 dias Facilidade para iniciantes 76/100
ekalinin/github-markdown-toc#203 ·
Mantenedores costumam responder em até 1 dia
-
bug
Dificuldade 3/5 1-2 dias Facilidade para iniciantes 70/100
ekalinin/github-markdown-toc#194 ·
Mantenedores costumam responder em até 1 dia
Todas as issues de ekalinin/github-markdown-toc
Issues semelhantes
-
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 66/100
-
bug
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 68/100
msys2/MINGW-packages#33356 · 1 comentário ·
Mantenedores costumam responder em até 1 dia
-
Misleading 'Update → Config → Hyprland' menu item silently resets user configs without confirmationTalvez já em andamento Um pull request vinculado a esta issue está aberto ou já foi mesclado. Aberta
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 72/100
Mantenedores costumam responder em até 1 dia
-
Dificuldade 1/5 1-3 horas Facilidade para iniciantes 88/100
-
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 78/100
kunchenguid/headless#23 ·