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
ci: check relative Markdown links and anchors - #575
scripts/check_markdown_links.py resolves every relative link and image target in tracked Markdown outside openvmm/, and every anchor against GitHub's heading slugs, ignoring fenced and inline code.
Runs in .github/actions/check-quality with its unit tests (scripts/test_check_markdown_links.py).
Fixes the one broken anchor it finds: aci_edge_sandboxes/README.md linked #native-proxy-and-forwarded-ports, a heading renamed to "Native proxy and host loopback".
Test
python scripts/check_markdown_links.py passes on this branch.
Nothing in CI checked the repository's relative links, so a renamed heading
broke its anchors silently. scripts/check_markdown_links.py resolves every
relative link and image target, and every anchor against GitHub's heading
slugs, ignoring code. Fix the one anchor it finds broken.
Co-Authored-By: Claude Haiku 5.5 <noreply@anthropic.com>
Fences close only on their own character and length. Setext headings, code
spans of any backtick length, multiline labels, and reference-style
definitions are handled. Slugs come from rendered heading text, and duplicate
suffixes skip slugs already taken. Each rule has a regression test.
Co-Authored-By: Claude Haiku 5.5 <noreply@anthropic.com>
Signed-off-by: jay23606 <4602056+jay23606@users.noreply.github.com>
Parse Markdown destinations with titles and balanced parentheses
scripts/check_markdown_links.py:33
This expression misses or truncates valid Markdown destinations. [guide](missing.md 'Guide') and [guide](<missing guide.md>) produce no targets, so broken links pass CI. [guide](guide(v2).md) produces guide(v2, so an existing file is reported missing. Parse angle-delimited destinations, balanced/escaped parentheses, and Markdown title delimiters, and add regression cases for these forms.
Decode HTML entities before generating heading slugs
scripts/check_markdown_links.py:93
HTML entities are not decoded before generating heading slugs. For example, # Fish & Chips renders with anchor fish--chips, but this checker generates fish-amp-chips. It therefore rejects the valid anchor and accepts an incorrect one. Decode entities after processing heading markup but before restoring stashed code spans, so entity text inside code remains literal, and add regression cases for both forms.
Preserve inline-code-only Setext heading anchors
scripts/check_markdown_links.py:104
A Setext heading containing only inline code, such as a line containing Setup in backticks followed by =====, loses its anchor: masking turns the heading text into whitespace, so the blank-line check discards it. GitHub generates setup, but this checker rejects links to it. Use nonblank placeholders for code spans during heading detection, while still masking fences, and add a regression case.
Strip query strings before resolving link paths
scripts/check_markdown_links.py:165
Query strings are treated as part of the filesystem path. Valid links such as README.md?plain=1 or image.png?raw=true are reported missing even when the file exists, causing the quality job to reject valid documentation. Strip the query before resolving the path, while retaining the fragment for anchor validation.
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
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.
Fixes #563
Summary
scripts/check_markdown_links.pyresolves every relative link and image target in tracked Markdown outsideopenvmm/, and every anchor against GitHub's heading slugs, ignoring fenced and inline code..github/actions/check-qualitywith its unit tests (scripts/test_check_markdown_links.py).aci_edge_sandboxes/README.mdlinked#native-proxy-and-forwarded-ports, a heading renamed to "Native proxy and host loopback".Test
python scripts/check_markdown_links.pypasses on this branch.python -m unittest discover -s scripts -p test_check_markdown_links.pypasses (6 tests).openvmm/are skipped: it is vendored and was not checked out in my clone, so two links into it could not be verified here.🤖 Generated with Claude Code