Crates.io | mdbook-lint |
lib.rs | mdbook-lint |
version | 0.11.5 |
created_at | 2025-08-04 01:37:48.328569+00 |
updated_at | 2025-08-29 15:42:49.820608+00 |
description | A fast markdown linter for mdBook |
homepage | |
repository | https://github.com/joshrotenberg/mdbook-lint |
max_upload_size | |
id | 1780231 |
size | 364,257 |
A fast, configurable linter designed for mdBook projects. Works as both an mdBook preprocessor and standalone CLI tool.
📖 Documentation | 🚀 Getting Started
Download the latest release for your platform from GitHub Releases:
mdbook-lint-linux-x86_64
mdbook-lint-linux-x86_64-musl
(static binary, no dependencies)mdbook-lint-windows-x86_64.exe
mdbook-lint-macos-x86_64
mdbook-lint-macos-aarch64
Extract and add to your PATH, or use with GitHub Actions (see CI Integration).
cargo install mdbook-lint
Verify the installation:
mdbook-lint --version
Add to your book.toml
:
[preprocessor.mdbook-lint]
Then run mdbook build
as usual. The linter will automatically check all your markdown files and report issues during the build process.
# Lint files
mdbook-lint lint README.md src/*.md
# Auto-fix violations where possible
mdbook-lint lint --fix src/*.md
# Preview what would be fixed
mdbook-lint lint --fix --dry-run src/*.md
# Show available rules
mdbook-lint rules
Create a .mdbook-lint.toml
file (also supports YAML/JSON):
# Enable only specific rules
[rules]
default = false
[rules.enabled]
MD001 = true
MD009 = true
# Or use traditional configuration
fail-on-warnings = true
disabled-rules = ["MD013"]
# Configure specific rules
[MD007]
indent = 4
[MD009]
br_spaces = 2 # Allow 2 trailing spaces for line breaks
See the example configuration for all available options.
Run mdbook-lint rules --detailed
to see all available rules.
name: Lint Documentation
on: [push, pull_request]
jobs:
lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Download mdbook-lint
run: |
curl -sSL https://github.com/joshrotenberg/mdbook-lint/releases/latest/download/mdbook-lint-linux-x86_64 -o mdbook-lint
chmod +x mdbook-lint
- name: Lint markdown files
run: ./mdbook-lint lint --fail-on-warnings docs/
Contributions are welcome! See our Contributing Guide for complete information.
MIT OR Apache-2.0