Markdown linting and auto-fix CLI for CommonMark files, docs repos, and content pipelines.
$npm install markdownlint-cli2 --global
Agent Compatibility
JSON Output
Agent Skill
MCP Support
AI Analysis
markdownlint-cli2 lints Markdown and CommonMark files across repos using directory-based configuration and the markdownlint rule set. It is built for docs checks, editor formatting flows, and CI runs where you want to find or automatically fix Markdown style issues.
What It Enables
- Lint Markdown files across a repo with glob patterns, nested config files, ignore rules, and custom rule or parser configuration.
- Auto-fix supported issues in place with
--fix, or format Markdown from stdin to stdout with--formatfor editor and pipeline workflows. - Emit machine-readable findings through configured formatter packages such as JSON, JUnit, SARIF, GitLab Code Quality, or summary reports.
Agent Fit
- Non-interactive runs and clear
0/1/2exit codes make inspect-edit-rerun verification loops straightforward. - Repo-level config discovery and
--fixsupport make it useful for documentation cleanup, pre-commit checks, and CI enforcement. - Structured output exists, but not as a one-off
--jsonflag; unattended setups need anoutputFormattersconfig entry such asmarkdownlint-cli2-formatter-json.
Caveats
- JSON and other report formats are configured through formatter modules, so automation usually needs a checked-in config file instead of an ad hoc flag.
- Auto-fix only covers rules that emit fix information, so some findings still need manual or agent-authored edits.