You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
html_navigation: heading anchors differ from GitHub's, so valid links fail and dead ones pass #102
A maintainer who links to a heading with the anchor GitHub actually generates gets a red check, while a link that is dead on GitHub passes. When that happens, the check is less trustworthy than simply clicking through the rendered page.
Evidence
Observed on 2026-10-23 at master 1114ffe (Python 3.14, Windows 11). The slug code is at tools/html_navigation.py:220-226.
Fixture README.md:
# Slugs-[a](#terms--conditions)-[b](#a--b)-[c](#a--b--c)-[d](#using-foo-safely)-[dead on GitHub](#terms-conditions)## Terms & Conditions## A B## a < b > c## Using _foo_ safely
python -I tools/html_navigation.py --root <fixture> exits 1 and reports the first four links as "missing section anchor". It accepts the fifth, which GitHub would break.
Heading
GitHub anchor
Tool anchor
Cause
## Terms & Conditions
terms--conditions
terms-conditions
runs of spaces are collapsed into one hyphen
## A B
a--b
a-b
same
## a < b > c
a--b--c
a-c
entities are decoded before tags are stripped, so < b > is removed as a tag
## Using _foo_ safely
using-foo-safely
using-_foo_-safely
emphasis markers are kept
## The __init__ method
the-init-method
the-__init__-method
same
## हिन्दी
हिन्दी
हनद
combining marks (\p{M}) are dropped by isalnum()
A local comparison with github-slugger's test cases disagreed on 31 of 78. tools/README.md:82-83 says ordinary ATX headings are supported.
Acceptance
Slugs follow GitHub's behaviour for the rendered heading text:
each space becomes its own hyphen;
combining marks and connector punctuation are kept;
HTML tags are stripped before entities are decoded;
emphasis markers are removed;
duplicates still get -1, -2.
Regression tests cover the table above. Expected values come from GitHub's rendering, or from github-slugger's fixtures with their licence and attribution checked before reuse.
tools/README.md lists the differences that remain.
Activity
fix(html-nav): generate heading anchors the way GitHub does