md-link-checker-cli
v1.0.0
Published
Check markdown files for broken links (both URLs and relative file links)
Maintainers
Readme
md-link-checker-cli
Check markdown files for broken links — both remote URLs and relative file paths.
Install
npm install -g md-link-checker-cliOr use directly with npx:
npx md-link-checker-cli -d ./docs -rUsage
md-link-check [options]Options
| Option | Description | Default |
|---|---|---|
| -d, --dir <path> | Directory (or file) to scan | . |
| -r, --recursive | Scan directories recursively | false |
| --timeout <ms> | Timeout for HTTP requests (ms) | 10000 |
| --json | Output results as JSON | false |
| -V, --version | Show version | |
| -h, --help | Show help | |
Examples
Scan current directory:
md-link-checkScan a docs folder recursively:
md-link-check -d ./docs -rCheck a single file with 5s timeout:
md-link-check -d README.md --timeout 5000JSON output for CI pipelines:
md-link-check -d ./docs -r --jsonWhat it checks
- Remote URLs (
http://,https://) — sends HEAD requests, follows redirects, retries with GET on 405/403 - Relative file links — verifies the target file exists on disk
- Skips anchor-only links (
#section),mailto:,tel:, anddata:URLs
Exit codes
0— all links OK1— one or more broken links found
License
MIT
