Repository navigation
Description
Summary
Add a CI check that validates relative links in markdown files, catching broken cross-references before they are merged.
Motivation
With many contributors submitting documentation PRs — and files being moved or renamed — broken relative links accumulate quickly. These are invisible until a user clicks them. An automated check catches them at PR time with zero reviewer effort.
Specification
Add a CI step that scans markdown files changed in a PR and verifies that all relative links point to files that exist in the repository.
What to check
- Standard markdown links:
[text](relative/path.md) - Image references:
 - MyST cross-references if applicable (e.g.,
{doc}\path``)
What to skip
- External URLs (
https://...,http://...) — these require network access and are a separate concern - Anchor-only links (
#section-heading) - Links inside fenced code blocks (
```) node_modules/,dist/, and other non-documentation paths
Behavior
- Run on
pull_requestevents (opened,synchronize). - Scan all
.mdfiles in the PR diff. - For each relative link, resolve it relative to the file's directory and check that the target exists in the repo.
- On failure, print each broken link with the source file, line number, and target path.
Implementation notes
- A simple approach: a shell or Python script that uses regex to extract
[...](...)patterns, filters to relative paths, and checks file existence withtest -f. - Be careful with links that include anchors (e.g.,
./setup.md#prerequisites) — strip the#...suffix before checking file existence. - The
docs/directory uses Sphinx/MyST, so also consider paths with or without.mdextensions depending on how cross-references are written. - Alternatively,
markdown-link-checkis a popular npm tool, but a custom script avoids adding a dependency and can be tailored to the repo's conventions.
Acceptance criteria
- CI fails when a PR introduces a broken relative link in a markdown file.
- Error output shows the source file, line number, and broken target path.
- External URLs, anchors, and code blocks are not false positives.
- Works for files in
docs/,README.md, andCONTRIBUTING.md.
Activity
ci: add markdown link checker for docs and README
ci: add markdown link checker for docs and README
ci: add markdown link checker for docs and README
ci: add markdown link checker for docs and README
ci: add markdown link checker for docs and README
ci: add markdown link checker for docs and README
ci: add markdown link checker for docs and README
ci: add markdown link checker for docs and README
13ernkastel commentedon Apr 5, 2026
Fixed by open PR #1139: #1139
13ernkastel commentedon Apr 5, 2026
Fixed by open PR #1139: #1139
I do not have permission to close issues in this repo from this account, so leaving this for a maintainer to close on review or merge.
ci(docs): check changed markdown links on pull requests (NVIDIA#1139)
ci(docs): check changed markdown links on pull requests (NVIDIA#1139)