Skip to content

ci: catch broken markdown links#403

Open
x-n2o wants to merge 1 commit into
ml-explore:mainfrom
x-n2o:markdown-link-check
Open

ci: catch broken markdown links#403
x-n2o wants to merge 1 commit into
ml-explore:mainfrom
x-n2o:markdown-link-check

Conversation

@x-n2o
Copy link
Copy Markdown

@x-n2o x-n2o commented May 10, 2026

Proposed changes

This PR adds the same broken Markdown link check as ml-explore/mlx-swift-examples#479.

It adds lychee to pre-commit in offline mode so the existing lint workflow catches broken Markdown links in CI, and updates the lint step wording to reflect that it now runs both style and Markdown link checks.

The first full local run shows the new check finding existing broken links; that failure is intentionally left visible for CI.

❯ pre-commit run --all-files
swift-format.............................................................Passed
cmake-format.............................................................Passed
lychee...................................................................Failed
- hook id: lychee
- exit code: 2

Issues found in 4 inputs. Find details below.

[Source/Cmlx/fmt/doc/index.md]:
 [ERROR] file:///Users/ledio/src/mlx-swift/Source/Cmlx/fmt/doc/api#compile-api (at 60:12) | File not found. Check if file exists and path is correct
 [ERROR] file:///Users/ledio/src/mlx-swift/Source/Cmlx/fmt/doc/api#compile-time-checks (at 27:10) | File not found. Check if file exists and path is correct
 [ERROR] file:///Users/ledio/src/mlx-swift/Source/Cmlx/fmt/doc/api#format (at 23:52) | File not found. Check if file exists and path is correct
 [ERROR] file:///Users/ledio/src/mlx-swift/Source/Cmlx/fmt/doc/api#udt (at 46:10) | File not found. Check if file exists and path is correct

[Source/MLX/Documentation.docc/MLX.md]:
 [ERROR] file:///Users/ledio/src/mlx-swift/Source/MLX/Documentation.docc/mlxnn (at 69:3) | File not found. Check if file exists and path is correct
 [ERROR] file:///Users/ledio/src/mlx-swift/Source/MLX/Documentation.docc/mlxoptimizers (at 70:3) | File not found. Check if file exists and path is correct

[Source/MLXNN/Documentation.docc/MLXNN.md]:
 [ERROR] file:///Users/ledio/src/mlx-swift/Source/MLXNN/Documentation.docc/mlx (at 46:3) | File not found. Check if file exists and path is correct
 [ERROR] file:///Users/ledio/src/mlx-swift/Source/MLXNN/Documentation.docc/mlxoptimizers (at 47:3) | File not found. Check if file exists and path is correct

[Source/MLXOptimizers/Documentation.docc/MLXOptimizers.md]:
 [ERROR] file:///Users/ledio/src/mlx-swift/Source/MLXOptimizers/Documentation.docc/mlx (at 34:3) | File not found. Check if file exists and path is correct
 [ERROR] file:///Users/ledio/src/mlx-swift/Source/MLXOptimizers/Documentation.docc/mlxnn (at 35:3) | File not found. Check if file exists and path is correct

🔍 2550 Total (in 5ms) 🔗 2467 Unique ✅ 56 OK 🚫 10 Errors 👻 2484 Excluded

Checklist

  • I have read the CONTRIBUTING document
  • I have run pre-commit run --all-files to format my code / installed pre-commit prior to committing changes
  • I have added tests that prove my fix is effective or that my feature works
  • I have updated the necessary documentation (if needed)

@x-n2o x-n2o marked this pull request as ready for review May 10, 2026 22:16
Copilot AI review requested due to automatic review settings May 10, 2026 22:16
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR adds an offline broken-Markdown-link check to the existing pre-commit-driven lint workflow (both locally and in CI) by introducing the lychee pre-commit hook, and updates the lint step wording to reflect the broader checks.

Changes:

  • Add lychee as a pre-commit hook (offline) to detect broken links in Markdown files.
  • Update the CI lint step name/message to mention Markdown link checks.
  • Add an acknowledgment entry for the contributor who introduced the link checks.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.

File Description
ACKNOWLEDGMENTS.md Adds contributor acknowledgment for the new Markdown link checks.
.pre-commit-config.yaml Introduces the lychee hook configured for offline Markdown link checking.
.github/workflows/pull_request.yml Renames the lint step and updates the failure message to include Markdown link checks.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread .pre-commit-config.yaml
Comment thread .github/workflows/pull_request.yml
@davidkoski
Copy link
Copy Markdown
Collaborator

This looks interesting, but:

This is a third party and we don't build docs for this -- we shouldn't be checking this.

[Source/Cmlx/fmt/doc/index.md]:
 [ERROR] file:///Users/ledio/src/mlx-swift/Source/Cmlx/fmt/doc/api#compile-api (at 60:12) | File not found. Check if file exists and path is correct
 [ERROR] file:///Users/ledio/src/mlx-swift/Source/Cmlx/fmt/doc/api#compile-time-checks (at 27:10) | File not found. Check if file exists and path is correct
 [ERROR] file:///Users/ledio/src/mlx-swift/Source/Cmlx/fmt/doc/api#format (at 23:52) | File not found. Check if file exists and path is correct
 [ERROR] file:///Users/ledio/src/mlx-swift/Source/Cmlx/fmt/doc/api#udt (at 46:10) | File not found. Check if file exists and path is correct

These links do resolve -- they are cross doc package links, see: https://swiftpackageindex.com/ml-explore/mlx-swift/main/documentation/mlx

[Source/MLX/Documentation.docc/MLX.md]:
 [ERROR] file:///Users/ledio/src/mlx-swift/Source/MLX/Documentation.docc/mlxnn (at 69:3) | File not found. Check if file exists and path is correct
 [ERROR] file:///Users/ledio/src/mlx-swift/Source/MLX/Documentation.docc/mlxoptimizers (at 70:3) | File not found. Check if file exists and path is correct

[Source/MLXNN/Documentation.docc/MLXNN.md]:
 [ERROR] file:///Users/ledio/src/mlx-swift/Source/MLXNN/Documentation.docc/mlx (at 46:3) | File not found. Check if file exists and path is correct
 [ERROR] file:///Users/ledio/src/mlx-swift/Source/MLXNN/Documentation.docc/mlxoptimizers (at 47:3) | File not found. Check if file exists and path is correct

[Source/MLXOptimizers/Documentation.docc/MLXOptimizers.md]:
 [ERROR] file:///Users/ledio/src/mlx-swift/Source/MLXOptimizers/Documentation.docc/mlx (at 34:3) | File not found. Check if file exists and path is correct
 [ERROR] file:///Users/ledio/src/mlx-swift/Source/MLXOptimizers/Documentation.docc/mlxnn (at 35:3) | File not found. Check if file exists and path is correct

@x-n2o
Copy link
Copy Markdown
Author

x-n2o commented May 11, 2026

Ah, I suppose this would require a gating mechanism or a mutli-repo checkout (overengineering?). I found .lycheeignore. I'll add the third-parties that resolve on swiftpackageindex.com/ml-explore.

@x-n2o x-n2o force-pushed the markdown-link-check branch from fe623f6 to a6fce24 Compare May 11, 2026 15:21
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