[ BUG ] TOC entries have no text on OS/390
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
- 82/100
Piste de recherche
Commencez dans gh-md-toc, dans la branche OS/390 de gh_toc_grab autour de la ligne 428, et comparez l’extraction du texte des titres avec l’expression mise à jour de la branche par défaut. L’issue comprend une reproduction sur macOS qui force cette branche ; exécutez-la pour confirmer les libellés TOC vides, puis vérifiez que les deux titres produisent le texte et les ancres attendus.
Rédigé par le modèle d'indexation à partir du texte de l'issue.
Description
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).
- 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 ] Headings are missing from the TOC when GitHub puts a line break after the heading tagOuvertebug
Difficulté 2/5 1-3 heures Accessibilité débutants 78/100
ekalinin/github-markdown-toc#201 ·
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 ·