# 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. ## Install Save as a script file and run: ## Quick Use ```bash npm install -g markdownlint-cli2 markdownlint-cli2 "**/*.md" ``` Or use the VS Code extension: search "markdownlint" in Extensions. ## What is Markdownlint? Markdownlint is a Node.js-based linter for Markdown files with 50+ configurable rules. It catches formatting inconsistencies, broken links, and structural issues — ensuring clean, consistent markdown in your CLAUDE.md, .cursorrules, README files, and AI-generated documentation. **Answer-Ready**: Markdownlint is a Node.js markdown linter with 50+ rules for consistent formatting. Lint CLAUDE.md, .cursorrules, README files, and AI-generated docs. Available as CLI, VS Code extension, and GitHub Action. 5k+ GitHub stars. **Best for**: Developers maintaining markdown-based AI tool configurations. **Works with**: VS Code, JetBrains, GitHub Actions, any CI/CD. **Setup time**: Under 1 minute. ## Core Features ### 1. 50+ Built-In Rules | Rule | Description | |------|-------------| | MD001 | Heading levels should increment by one | | MD009 | No trailing spaces | | MD013 | Line length limit | | MD024 | No duplicate headings | | MD032 | Lists should be surrounded by blank lines | | MD033 | No inline HTML | | MD041 | First line should be a top-level heading | ### 2. Configuration ```json // .markdownlint.json { "MD013": { "line_length": 120 }, "MD033": false, "MD041": false, "MD024": { "siblings_only": true } } ``` ### 3. VS Code Integration Install the markdownlint extension: - Real-time linting as you type - Quick fixes for common issues - Works on CLAUDE.md, .cursorrules, README.md ### 4. CI/CD Integration ```yaml # .github/workflows/lint.yml name: Lint Markdown on: [push, pull_request] jobs: lint: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - uses: DavidAnson/markdownlint-cli2-action@v19 with: globs: "**/*.md" ``` ### 5. Fix Automatically ```bash # Auto-fix fixable issues markdownlint-cli2 --fix "**/*.md" ``` ### 6. Ignore Patterns ``` # .markdownlintignore node_modules/ dist/ CHANGELOG.md ``` ## Use with AI Tool Configs ### CLAUDE.md Linting ```bash # Lint your Claude Code config markdownlint-cli2 CLAUDE.md ``` ### .cursorrules Linting ```bash # Treat .cursorrules as markdown markdownlint-cli2 .cursorrules ``` ### AI-Generated Content ```bash # Lint AI-generated docs before committing markdownlint-cli2 --fix docs/**/*.md ``` ## Common Fixes | Issue | Fix | |-------|-----| | Trailing spaces | Auto-fix removes them | | Missing blank lines | Auto-fix adds them | | Inconsistent list markers | Auto-fix standardizes to `-` | | Multiple blank lines | Auto-fix collapses to one | ## FAQ **Q: Does it work with MDX?** A: Partially — it handles standard markdown syntax. JSX blocks may trigger false positives; disable specific rules as needed. **Q: Can I create custom rules?** A: Yes, via the plugin API. Write rules as Node.js modules. **Q: Is there a pre-commit hook?** A: Yes, use with husky or lefthook for pre-commit linting. ## Source & Thanks > Created by [David Anson](https://github.com/DavidAnson). Licensed under MIT. > > [DavidAnson/markdownlint](https://github.com/DavidAnson/markdownlint) — 5k+ stars ## 快速使用 ```bash npm install -g markdownlint-cli2 markdownlint-cli2 "**/*.md" ``` 一行命令检查所有 Markdown 文件格式。 ## 什么是 Markdownlint? Node.js Markdown 检查器,50+ 规则确保格式一致。适用于 CLAUDE.md、.cursorrules、README 等文件。 **一句话总结**:Node.js Markdown 检查器,50+ 规则,确保 CLAUDE.md、.cursorrules 和文档格式一致,5k+ GitHub stars。 **适合人群**:维护 Markdown AI 工具配置的开发者。 ## 核心功能 ### 1. 50+ 规则 标题层级、尾部空格、行长度、重复标题等。 ### 2. VS Code 集成 实时检查,快速修复。 ### 3. CI/CD 集成 GitHub Actions 一键配置。 ### 4. 自动修复 `--fix` 参数自动修复常见问题。 ## 常见问题 **Q: 支持 MDX 吗?** A: 部分支持,JSX 可能触发误报,按需禁用规则。 **Q: 有 pre-commit hook 吗?** A: 有,配合 husky 或 lefthook 使用。 ## 来源与致谢 > [DavidAnson/markdownlint](https://github.com/DavidAnson/markdownlint) — 5k+ stars, MIT --- Source: https://tokrepo.com/en/workflows/2f24f820-a8de-430f-87d7-945401c6a0e3 Author: Script Depot