Skip to content

feat: CI link validation for MDX content#190

Merged
ErnestM1234 merged 5 commits intomainfrom
ci/link-validation
Mar 31, 2026
Merged

feat: CI link validation for MDX content#190
ErnestM1234 merged 5 commits intomainfrom
ci/link-validation

Conversation

@moss-bryophyta
Copy link
Copy Markdown
Collaborator

Summary

Adds a TypeScript-based link validator that runs in CI on every PR.

What it validates

  • Internal links (starting with /) resolve to actual files
  • Anchor fragments (#heading) exist in the target file
  • Same-page anchors validated against current file headings
  • Custom heading IDs via [#id] syntax (e.g. ## My Heading [#custom-id])
  • Locale-optional paths/docs/next/intro and /en-US/docs/next/intro both valid
  • Template placeholder links — expands __DOCS_PATH__ etc. for next/react/react-native and validates each

Files

  • scripts/validate-links.ts — main validator (mdast AST parser + github-slugger)
  • scripts/test-validate-links.ts — unit tests
  • scripts/package.json + lockfile + .gitignore
  • .github/workflows/validate.yml — added validate-links job

Note

There are 33 pre-existing broken links in the current content (missing files in react-native, empty generated pages, stale anchors). These are real issues, not false positives. CI will flag them on this PR — they can be fixed in a follow-up or in this PR before merge.

Loading
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants