# mdrefcheck
[](https://pypi.org/project/mdrefcheck/)
[](https://crates.io/crates/mdrefcheck)
[](https://github.com/gospodima/mdrefcheck/actions/workflows/ci.yml)
[](./LICENSE)
A CLI tool to validate references and links in Markdown files (CommonMark spec).
It helps to ensure that your documentation is free from broken section links, missing images or files.
## Features
- Validate local file paths in image and file references
- Check section links against actual headings, following [GitHub Flavored Markdown (GFM)](https://docs.github.com/en/get-started/writing-on-github/getting-started-with-writing-and-formatting-on-github/basic-writing-and-formatting-syntax#section-links) rules, including cross-file references (e.g. `./subfolder/another-file.md#heading-link`)
- Detect broken reference-style links
- Basic email validation
## Installation
### Cargo
```bash
cargo install mdrefcheck
```
### PyPI
```bash
pip install mdrefcheck
```
or run it directly in an isolated environment, e.g., with `uvx`:
```bash
uvx mdrefcheck .
```
## Pre-commit integration
Add this to your `.pre-commit-config.yaml`:
```yaml
repos:
- repo: https://github.com/gospodima/mdrefcheck
rev: v0.1.8
hooks:
- id: mdrefcheck
```