Skip to content

ci: add markdown link checker for docs and README #552

Description

@cv

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: ![alt](relative/path.png)
  • 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_request events (opened, synchronize).
  • Scan all .md files 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 with test -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 .md extensions depending on how cross-references are written.
  • Alternatively, markdown-link-check is 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, and CONTRIBUTING.md.

Activity

  1. added 8 commits that reference this issue on Mar 24, 2026
    9b6c250
    f8a636c
    f1891a9
    9421cf2
    c72e9cd
    31a13f7
    8192279
    f4fa77e
  2. 13ernkastel commented on Apr 5, 2026

    @13ernkastel
    Contributor

    Fixed by open PR #1139: #1139

  3. 13ernkastel commented on Apr 5, 2026

    @13ernkastel
    Contributor

    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.

  4. added
    area: ci
    area: e2e
    enhancement
    and removed on Jun 3, 2026
  5. removed
    enhancement
    on Jun 8, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    area: ciarea: e2e

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions