Add cross-version link linter to prevent documentation version mixing#21923
Merged
ebembi-crdb merged 3 commits intomainfrom Jan 20, 2026
Merged
Add cross-version link linter to prevent documentation version mixing#21923ebembi-crdb merged 3 commits intomainfrom
ebembi-crdb merged 3 commits intomainfrom
Conversation
- Add Python script to detect cross-version links in markdown files - Add GitHub Actions workflow to run on PRs - Add comprehensive unit tests - Block PR merge if cross-version links are detected - Provide clear error messages with suggested fixes
Files changed:
|
✅ Deploy Preview for cockroachdb-interactivetutorials-docs canceled.
|
✅ Deploy Preview for cockroachdb-api-docs canceled.
|
✅ Netlify Preview
To edit notification comments on pull requests, go to your Netlify project configuration. |
- Fix markdown_relative regex to detect multiple ../ levels (e.g., ../../v23.1/) - Broaden ALLOWED_PATTERNS to match site.versions["stable"] bracket notation - Make image_ref fix more robust by targeting images/vX.X/ pattern - Improve markdown link fix to preserve full nested paths instead of just filename - Add 9 new unit tests covering multi-level paths, bracket notation, and complex filenames
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.
Summary
This PR adds a linter that prevents cross-version links in documentation PRs. The linter ensures that documentation for each version only links to pages within the same version, preventing broken links when older versions are archived.
Motivation
What this PR does
Cross-version link patterns detected
{% link v21.2/backup.md %}{% include_cached v22.1/provision.md %}{{ 'images/v22.2/diagram.png' | relative_url }}[text](../v20.1/page.md)[text](/docs/v19.1/page.md)<a href="v18.2/page.html">Testing
{{ page.version.version }}Notes