Conversation
Clusters render as "## {value}" headings and are linked with an anchor built
by a hand-rolled slugifier, duplicated in name_to_section() and inline in
cluster_transform_to_link(). It strips only "/" and ":", while
Python-Markdown's toc extension -- which actually assigns the heading ids --
strips every non-word character.
Across all 56,131 cluster values, 7,788 links (13.9%) target an anchor the
renderer never emits:
punctuation the hand-rolled version does not strip 7058
non-ASCII in the name 569
other (whitespace/separator handling) 161
e.g. 'SKILL.md Prompt Injection - ATR-2026-00120' was linked as
'skill.md-prompt-injection-...' but renders as 'skillmd-prompt-injection-...'.
Delegate to markdown.extensions.toc.slugify and have
cluster_transform_to_link() call name_to_section() rather than keep a second
copy. Markdown==3.8.1 is already pinned in requirements.txt, so no new
dependency.
Verified against Markdown 3.8.1: 0 of 56,131 anchors now mismatch.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01HZGwPoa8MMfkhCw47rDLA4
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
BLUF — 13.9% of galaxy doc links point at heading anchors the Markdown renderer never creates.
tools/mkdocs/utils/helper.py—name_to_section()at line 12 and inline incluster_transform_to_link()at line 50 — which strips only slashes and colons, while Python-Markdown'stocextension that actually assigns the heading ids strips all non-word characters.markdown.extensions.toc.slugify, the same function that mints the ids, so links and headings cannot disagree.Problem
Every cluster renders as a
## {value}heading, and the documentation links to it with an anchor built by a hand-rolled slugifier — duplicated in two places,name_to_section()athelper.py:12and inline incluster_transform_to_link()athelper.py:50:Python-Markdown's
tocextension — which is what actually assigns the heading ids — strips all non-word characters, not just/and:. So any value containing a comma, a period, a parenthesis, an ampersand and so on gets a link pointing at an anchor that does not exist on the page.Measured across all 56,131 cluster values:
The bulk of it is plain ASCII punctuation, nothing exotic:
Fix
Delegate to Python-Markdown's own
markdown.extensions.toc.slugify— the function that generates the heading ids — so a link can never point at an anchor the renderer did not create.cluster_transform_to_link()now callsname_to_section()instead of carrying a second copy of the logic.Markdown==3.8.1is already pinned intools/mkdocs/requirements.txt(mkdocs depends on it), so this adds no new dependency.Verification
Against the real Markdown 3.8.1, over every cluster value:
Note
For non-ASCII names the shared function now produces what the renderer produces — e.g.
海莲花 - APT-C-00→-apt-c-00. That is a correct link where there was a broken one, but it is not a readable anchor. If you would prefer CJK and Cyrillic names to keep their characters, adding a unicode slugify tomkdocs.yml:would fix that — and because both sides now share one function, the links would follow automatically. That changes existing URLs, so I have left it out of this PR.
🤖 Generated with Claude Code