Repository navigation
docs: make every anchor resolve, on the wiki as well as GitHub - #542
Merged
Merged
Conversation
Neither link checker validated the fragment half of a link, so anchors were free to rot. Measuring them turned up 11 that resolve on GitHub and are dead on the published wiki, plus 2 dead everywhere. The cause is in site/wiki.js. Its headingSlug is commented "GitHub/GFM-style heading id" but ends with .replace(/-+/g, '-'), and GitHub does not collapse runs of dashes. A heading like `10. Domain / DSL Surfaces` loses the slash and keeps the spaces either side, so GitHub gives 10-domain--dsl-surfaces and the wiki gave 10-domain-dsl-surfaces. Every link written against the rendering on GitHub therefore died on the site readers actually use, including the whole "10. Domain / DSL Surfaces" row of the language spec index, which is the DSL feature set the vision leads with. Removing the collapse makes the comment true. Measured both ways across all 122 internal anchor links first: 11 work on GitHub and not the wiki, 0 work on the wiki and not GitHub, so this fixes 11 and breaks nothing. The 2 broken everywhere were stale heading text in the spec index, pointing at #36-attributes-selected and #45-pipe--declarative-ordering after the headings were renamed. Both now resolve. check_doc_links.py gains fragment validation: 122 fragments checked, with a closest-heading suggestion on failure. `#` came out of the external-skip list at the same time, because a same-page anchor is not an external link and 55 of them were being skipped entirely. sync_version.py gains docs/wiki-home.md. The wiki front page advertised v0.10 and "Version | 0.10.0" while the canonical version is 0.11.1, because nothing pointed the version checker at it. Both now read 0.11.1 and drift fails the check. 122/122 anchors resolve under both sluggers. Unit 1425 passed, ruff clean. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
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.
Third of the wiki series. Independent of #540 and #541; branches from main and touches different files.
Nothing was checking anchors
Neither
check_doc_links.pynorcheck_wiki_links.pylooked at the#fragmenthalf of a link. Both strip it and validate the path. So anchors were free to rot, and had.I measured all 122 internal anchor links under both slug algorithms before changing anything:
The cause is in the wiki's own slugger
site/wiki.jshas this, commented "GitHub/GFM-style heading id (matches LANGUAGE_SPEC.md TOC anchors)":GitHub does not collapse runs of dashes. A heading like
10. Domain / DSL Surfacesloses the slash and keeps the space either side of it, so GitHub produces10-domain--dsl-surfaceswhile the wiki produced10-domain-dsl-surfaces. Every anchor an author wrote by copying it out of GitHub's rendering therefore worked there and died on the site readers actually use.That included the entire 10. Domain / DSL Surfaces row of
docs/language/spec-index.md, all four links plus the section header. That is theflow/evolves as/ dynamics / field-PDE material the vision leads with, linked from the page whose one job is finding parts of the language.Removing the collapse makes the comment true. Because 0 links depend on the collapsed form, this fixes 11 and breaks nothing.
The two that were broken everywhere
Stale heading text in the spec index, left behind when the headings were renamed:
#36-attributes-selected### 3.6 Attributes#45-pipe--declarative-ordering### 4.5 Pipe / Declarative Ordering and SearchWhat now guards it
check_doc_links.pyvalidates fragments against the target page's headings, numbering repeats the way GitHub does (notes,notes-1,notes-2) and honouring hand-written<a id="...">. On failure it suggests the closest heading:#also came out of theEXTERNALskip list. A same-page anchor is not an external link, and leaving it there meant 55 of them were never checked. Fragment coverage goes 0 → 122.A unit test pins
site/wiki.jsitself, since the Python and JS sluggers are held together only by both refusing to collapse.Version drift
sync_version.pygainsdocs/wiki-home.md. The wiki front page was advertising v0.10 and| Version | 0.10.0 |while the canonical version is 0.11.1, because the mirror list covered README.md and four others but never the wiki's own front door. Both strings now read 0.11.1, and future drift fails--check.Validation
check_doc_links.py: 1408 links, 122 fragments, all resolvesync_version.py --check: in synccheck_wiki_links.pyclean, wiki rebuildsruff check srcclean