Skip to content
Use this GitHub action with your project
Add this Action to an existing workflow or create a new one
View on Marketplace

Latest commit

Β 

History

890 Commits

Folders and files

NameName
Last commit message
Last commit date
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

Mado

CI codecov

A fast Markdown linter written in Rust. Compatible with CommonMark and GitHub Flavored Markdown (GFM).

Usage

mado check .
mado check path/to/*.md

Performance

Approx. 49-60x faster than existing linters (e.g. markdownlint).

---
config:
    xyChart:
        height: 200
        titleFontSize: 14
        chartOrientation: horizontal
        xAxis:
            labelFontSize: 12
            titleFontSize: 14
        yAxis:
            labelFontSize: 12
            titleFontSize: 14
---
xychart-beta
    title "Linting ~1,500 Markdown files (Lower is faster)"
    x-axis ["mado (rust)", "markdownlint-cli (node.js)", "markdownlint (ruby)", "markdownlint-cli2 (node.js)"]
    y-axis "Time (seconds)" 0 --> 10
    bar [0.129, 6.381, 6.609, 7.817]
Loading

This benchmark was conducted on a MacBook Pro (2021, M1 Max) using hyperfine with GitLab documentation as the dataset.

Installation

Homebrew (macOS and Linux)

brew tap akiomik/mado https://github.com/akiomik/mado.git
brew install mado

Nix (macOS and Linux)

nix profile install github:akiomik/mado

Arch Linux (Linux)

pacman -S mado

Scoop (Windows)

scoop install https://raw.githubusercontent.com/akiomik/mado/refs/heads/main/pkg/scoop/mado.json

WinGet (Windows)

# For security reasons, installing from local manifest files requires that this feature be enabled by an administrator.
# For more details, see https://learn.microsoft.com/en-us/windows/package-manager/winget/install#local-install
winget settings --enable LocalManifestFiles

curl.exe -o mado.yml https://raw.githubusercontent.com/akiomik/mado/refs/heads/main/pkg/winget/mado.yml
winget install -m mado.yml

Manually

Pre-built binaries are available for download from the release page.

Supported Rules

Mado supports most markdownlint rules.

  • βœ… Stable support
  • πŸ”¨ Unstable support
  • ⚠️ Unsupported option(s)
  • ❌ Not supported
Rule Support Note
MD001 βœ…
MD002 βœ…
MD003 πŸ”¨
MD004 βœ…
MD005 βœ…
MD006 βœ…
MD007 πŸ”¨
MD009 βœ…
MD010 βœ…
MD012 βœ…
MD013 βœ…
MD014 βœ…
MD018 βœ…
MD019 βœ…
MD020 πŸ”¨
MD021 βœ…
MD022 βœ…
MD023 βœ…
MD024 βœ…
MD025 βœ…
MD026 βœ…
MD027 πŸ”¨
MD028 βœ…
MD029 βœ…
MD030 βœ…
MD031 βœ…
MD032 πŸ”¨
MD033 βœ…
MD034 βœ…
MD035 βœ…
MD036 βœ…
MD037 βœ…
MD038 βœ…
MD039 βœ…
MD040 βœ…
MD041 βœ…
MD046 βœ…
MD047 βœ…

Configuration

Mado can be configured via mado.toml or .mado.toml file in the current directory. You can also use global configuration files located in:

  • Linux: ~/.config/mado/mado.toml
  • macOS: ~/.config/mado/mado.toml
  • Windows: ~\AppData\Roaming\mado\mado.toml

For more details, see the example mado.toml and the JSON Schema for mado.toml.

GitHub Actions

Mado is compatible with GitHub Actions.

# Basic usage (runs `mado check .`)
- uses: akiomik/mado@v0.3.1

# Custom usage (runs `mado` with specified arguments)
- uses: akiomik/mado@v0.3.1
  with:
    args: '--config path/to/mado.toml check path/to/*.md'

The action downloads the mado release it was published with. Setting the version input names a different release to run; a pin from before the input was added ignores it.

Development

just is required.

Running Tests

just test

Linting Code

just lint

Acceptance Testing

Compares what mado and mdl report for markdownlint's own rule fixtures. This needs mdl, cargo and git on PATH.

# Download the fixtures and set aside the ones written against their own style
./scripts/acceptance/setup.sh

# Write each tool's findings to tmp/mdl.txt and tmp/mado.txt
./scripts/acceptance/test.sh

diff tmp/mdl.txt tmp/mado.txt

That diff is not expected to be empty. Some of it is the two tools disagreeing and some of it is the two configurations differing, which is being worked out in #401.

Benchmarking

This needs hyperfine, mdl, node, npm, cargo and git on PATH.

# Download Markdown dataset
./scripts/benchmarks/setup.sh

# Install the markdownlint commands the comparison runs against
npm --prefix scripts/benchmarks ci

# Benchmark mado, mdl and markdownlint-cli using hyperfine
./scripts/benchmarks/comparison.sh

Profiling

First, install flamegraph:

cargo install flamegraph

Then run:

just flamegraph

Fuzz Testing

First, install cargo-fuzz:

cargo install cargo-fuzz

Then run:

just fuzz

About

A fast Markdown linter written in Rust.

Topics

Resources

Contributing

Stars

403 stars

Watchers

2 watching

Forks

Releases

Packages

Used by

Contributors

Languages