Repository navigation
fix(validator): check #anchor fragments on references/ links - #626
Merged
Merged
Conversation
addyosmani
approved these changes
Oct 3, 2026
addyosmani
left a comment
Owner
There was a problem hiding this comment.
praise: exactly the shape I hoped for on #625: same rule, same scope, it just stops a heading rename from breaking links silently. It passes on today's main with all 26 anchors in scope, including the ones #580 added an hour ago, and when I broke one it failed naming the line and the missing slug. The tests cover the GitHub slug cases that matter (the -1 duplicate, rendered text, fenced headings). Merging.
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.
Closes #625.
What
validate-reference-links.jsalso resolves the#fragmentafter areferences/*.mdlink: it slugs the target file's headings the way GitHub does and fails when none matches. Same rule and scope as before; only links the validator already matched gain the check, and only when their file exists, so a missing file is still reported once.Slugs follow GitHub's rules, as asked in #625: the rendered heading text (link text kept, emphasis and code spans unwrapped), lowercased, punctuation other than
-and_dropped, spaces to hyphens, and-1,-2for repeated headings. Headings inside fenced blocks don't count; the bash comments inaccessibility-checklist.md(# Chrome DevTools → Lighthouse → Accessibility) would otherwise read as H1s. The path hint only prints when a path is wrong, and anchor failures get their own hint.Verification
node --test scripts/validate-reference-links-test.jsapplication/vnd.github.html, at9d0c60d)skills/idea-refine/examples.mdhas three "Phase 1: Understand & Expand"phase-1-understand--expand,-1,-2; 17/17 identical9d0c60d#rate-limiting(SKILL.mdL125) and#destructive-path-operations(hardening-patterns.mdL208) renamed### Injectionrenamed to### Injection attacksSKILL.mdL85, exit 1; upstream main passesvalidate-skills,-commands,-artifact-paths,-versions, the otherscripts/*-test.js,run-evals.js,session-start-test.shCoordination
A correction to #625: of the 14 anchors #621 adds, 12 are same-file links inside
review-checklists.md, which stay out of scope; the other 2 arereferences/links fromSKILL.md, and both resolve with this check. #524 also touches the test file; these tests are appended as a block, as in #588.Out of scope, as agreed in #625: same-file
#anchorlinks, links outsidereferences/and HTMLidanchors. Setext headings aren't slugged either; none of the reference files use them.