Markdownlint — Lint Markdown for AI Content Quality
Node.js markdown linter with 50+ rules. Ensure consistent formatting in CLAUDE.md, .cursorrules, README files, and AI-generated documentation across your project.
Review-first install path
This asset needs a review step. The copied prompt tells the agent to dry-run, show the writes, then proceed only after confirmation.
npx -y tokrepo@latest install 2f24f820-a8de-430f-87d7-945401c6a0e3 --target codexDry-run first, confirm the writes, then run this command.
What it is
Markdownlint is a Node.js-based linter for Markdown files with 50+ configurable rules. It catches formatting inconsistencies, structural issues, and style violations in markdown content. The tool is available as a CLI (markdownlint-cli2), VS Code extension, and GitHub Action.
It is particularly useful for teams maintaining markdown-based AI tool configurations like CLAUDE.md, .cursorrules, and README files. As AI-generated documentation becomes more common, consistent markdown formatting prevents rendering issues and improves readability across platforms.
How it saves time or tokens
Markdownlint automates style enforcement that would otherwise require manual review. Instead of scanning documents for inconsistent heading levels, trailing spaces, or missing blank lines, you run a single command and get a list of violations. This is especially valuable when AI assistants generate markdown, as LLMs sometimes produce inconsistent formatting that compiles but renders poorly. Estimated token usage for this workflow is around 3,800 tokens.
How to use
- Install the CLI:
npm install -g markdownlint-cli2. - Run the linter:
markdownlint-cli2 '*/.md'to check all markdown files. - Configure rules in
.markdownlint.jsonor.markdownlint-cli2.jsoncto match your project standards. - Add to CI: use the GitHub Action or pre-commit hook to catch issues before merge.
Example
// .markdownlint.json
{
"MD013": { "line_length": 120 },
"MD033": false,
"MD024": { "siblings_only": true },
"MD041": true
}
# Lint all markdown files
markdownlint-cli2 '**/*.md'
# Fix auto-fixable issues
markdownlint-cli2 --fix '**/*.md'
# Lint only CLAUDE.md and README
markdownlint-cli2 CLAUDE.md README.md
Related on TokRepo
- AI tools for documentation -- find tools for maintaining and generating technical docs.
- AI tools for coding -- explore linters, formatters, and developer productivity tools.
Common pitfalls
- Running with default rules may flag too many issues in existing projects. Start by disabling noisy rules like MD013 (line length) and gradually enable stricter checks.
- The VS Code extension and CLI may use different rule versions. Pin the same version in both to avoid conflicting results.
- Markdownlint checks formatting, not content accuracy. It will not catch factual errors or broken external links -- use a separate link checker for that.
Frequently Asked Questions
Markdownlint includes 50+ rules covering heading structure (MD001, MD003), whitespace (MD009, MD010), line length (MD013), list formatting (MD032), inline HTML (MD033), and more. Each rule can be individually enabled, disabled, or configured.
Use the official GitHub Action or add markdownlint-cli2 to your CI script. Run `markdownlint-cli2 '**/*.md'` and fail the build on non-zero exit code. Configuration is read from .markdownlint.json in your repository root.
Yes. Run `markdownlint-cli2 --fix` to automatically fix issues that have auto-fix support, such as trailing spaces, inconsistent list markers, and missing blank lines. Not all rules support auto-fix.
Yes. CLAUDE.md files are standard markdown. Markdownlint checks them like any other .md file. You can create project-specific rule configurations to match the formatting conventions used in your AI tool configurations.
markdownlint is the core Node.js library with the rule engine. markdownlint-cli2 is the recommended CLI wrapper that adds glob support, configuration file loading, and better output formatting. Use markdownlint-cli2 for command-line usage.
Citations (3)
- markdownlint GitHub— Markdownlint provides 50+ configurable rules for markdown linting
- markdownlint-cli2 GitHub— markdownlint-cli2 is the recommended CLI for markdownlint
- VS Code Marketplace— VS Code extension for markdownlint
Related on TokRepo
Source & Thanks
Created by David Anson. Licensed under MIT.
DavidAnson/markdownlint — 5k+ stars
Discussion
Related Assets
agnix — Lint & Fix Agent Configs
Lint and auto-fix agent config files (CLAUDE.md, SKILL.md, hooks, MCP configs) to catch broken setups before tools silently ignore them.
mdBook — Create Books from Markdown Like Gitbook in Rust
mdBook creates online books from Markdown files, similar to Gitbook but implemented in Rust. Used for the official Rust Book, Cargo Book, Tokio Tutorial, and many open-source documentation sites. Fast builds and a clean default theme.
markdown-it — Fast Pluggable Markdown Parser for JavaScript
A CommonMark-compliant markdown parser with a rich plugin ecosystem, GFM support, and configurable syntax extensions for both Node.js and browsers.
Showdown — Bidirectional Markdown to HTML Converter in JavaScript
Showdown is a JavaScript library that converts Markdown to HTML and back, running in both the browser and Node.js with extensive extension support for custom syntax.