Skip to main content

Tool for finding broken references and links in Markdown files.

Project description

RefCheck

PyPI Downloads Python License: MIT CI/CD

RefCheck is a simple tool for finding broken references and links in Markdown files.

usage: refcheck [OPTIONS] [PATH ...]

positional arguments:
  PATH                  Markdown files or directories to check

options:
  -h, --help            show this help message and exit
  -e, --exclude [ ...]  Files or directories to exclude
  -cm, --check-remote   Check remote references (HTTP/HTTPS links)
  -nc, --no-color        Turn off colored output
  -v, --verbose         Enable verbose output
  --allow-absolute      Allow absolute path references like [ref](/path/to/file.md)

Features

  • 🔍 Comprehensive Reference Detection - Find and validate various reference patterns in Markdown files
  • Broken Link Highlighting - Quickly identify broken references with clear error messages
  • 📁 File Path Validation - Support for both absolute and relative file paths to any file type
  • 🌐 Remote URL Checking - Validate external HTTP/HTTPS links (optional with --check-remote)
  • 🎯 Header Reference Validation - Verify links to specific sections within Markdown files
  • 🛠️ User-Friendly CLI - Simple and intuitive command-line interface
  • ⚙️ CI/CD Ready - Perfect for automated quality checks in your documentation workflows
  • 🎨 Colored Output - Clear, color-coded results for easy scanning (disable with --no-color)
  • 📊 Detailed Reporting - Summary statistics and line-by-line reference validation
  • 🚀 Pre-commit Integration - Available as a pre-commit hook for automated validation

Installation

RefCheck is available on PyPI:

pip install refcheck

# or using pipx
pipx install refcheck

Examples

$ refcheck README.md

[+] 1 Markdown files to check.
- README.md

[+] FILE: README.md...
README.md:3: #introduction - OK
README.md:5: #installation - OK
README.md:6: #getting-started - OK

Reference check complete.

============================| Summary |=============================
🎉 No broken references!
====================================================================
$ refcheck . --check-remote

[+] Searching for markdown files in C:\Users\flumi3\github\refcheck ...

[+] 2 Markdown files to check.
- tests\sample_markdown.md
- docs\Understanding-Markdown-References.md

[+] FILE: tests\sample_markdown.md...
tests\sample_markdown.md:39: /img/image.png - BROKEN
tests\sample_markdown.md:52: https://www.openai.com/logo.png - BROKEN

[+] FILE: docs\Understanding-Markdown-References.md...
docs\Understanding-Markdown-References.md:42: #local-file-references - OK

Reference check complete.

============================| Summary |=============================
[!] 2 broken references found:
tests\sample_markdown.md:39: /img/image.png
tests\sample_markdown.md:52: https://www.openai.com/logo.png
====================================================================

Pre-commit Hook

RefCheck is also available as pre-commit hook!

- repo: https://github.com/flumi3/refcheck
  rev: v0.4.2
  hooks:
    - id: refcheck
      args: ["docs/", "-e", "docs/filetoexclude.md"] # e.g. scan the docs/ folder and exclude a file

For more advanced configuration options, see the Integration Guide.

Contributing

Contributions are welcome!

Please see CONTRIBUTING.md for:

  • Development setup instructions
  • Commit message conventions
  • Code quality standards
  • Testing requirements
  • Pull request guidelines

Documentation

For more detailed information, check out the documentation:

License

This project is licensed under the MIT License - see the LICENSE file for details.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

refcheck-0.4.2.tar.gz (13.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

refcheck-0.4.2-py3-none-any.whl (14.0 kB view details)

Uploaded Python 3

File details

Details for the file refcheck-0.4.2.tar.gz.

File metadata

  • Download URL: refcheck-0.4.2.tar.gz
  • Upload date:
  • Size: 13.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.12.8

File hashes

Hashes for refcheck-0.4.2.tar.gz
Algorithm Hash digest
SHA256 10838814373be0e3c2f63e998f325c90ec9f88a3b6db1670b4a0991d2096b02e
MD5 3a79d35ff670d93b7018415a550f03ad
BLAKE2b-256 f95f53b7c0864621502c57bb9cf1276fb2680626a943fe027caa318d1c620220

See more details on using hashes here.

Provenance

The following attestation bundles were made for refcheck-0.4.2.tar.gz:

Publisher: ci-cd.yml on flumi3/markdown-refcheck

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file refcheck-0.4.2-py3-none-any.whl.

File metadata

  • Download URL: refcheck-0.4.2-py3-none-any.whl
  • Upload date:
  • Size: 14.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.12.8

File hashes

Hashes for refcheck-0.4.2-py3-none-any.whl
Algorithm Hash digest
SHA256 c2a475d42737a4185ec81891210ad4b2935f10b05f57dec1d5ffc19f220a8a21
MD5 7882454710844e81c962abc1fe5fd6e6
BLAKE2b-256 c99bdd64e2ed8ba6053188d43404847b5a41e769ac267092cea1e171f79904df

See more details on using hashes here.

Provenance

The following attestation bundles were made for refcheck-0.4.2-py3-none-any.whl:

Publisher: ci-cd.yml on flumi3/markdown-refcheck

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page