This skill should be used when users need to format, clean, lint, or validate Markdown files using the markdownlint-cli2 command-line tool.
IMPORTANT: This project uses .markdownlint.yaml. Always follow these rules:
| Rule | Setting | Notes |
|---|---|---|
| MD040 | Enabled | Always specify language for code fences |
| MD007 | 2 spaces | List indentation |
| MD024 | Siblings only | Duplicate headings allowed under different parents |
| MD013 | Disabled | No line length restrictions |
| MD033 | Disabled | Inline HTML allowed |
| MD041 | Disabled | Files don't need to start with H1 |
| MD038 | Disabled | Spaces in code spans allowed |
| MD036 | Disabled | Emphasis as heading allowed |
# Lint files
markdownlint-cli2 "**/*.md"
markdownlint-cli2 README.md
# Auto-fix issues
markdownlint-cli2 --fix "**/*.md"
# Exclude directories
markdownlint-cli2 "**/*.md" "#node_modules" "#vendor"
markdownlint-cli2 README.md # Single file
markdownlint-cli2 "docs/**/*.md" # Directory
markdownlint-cli2 "*.md" "docs/**/*.md" # Multiple patterns
markdownlint-cli2 . # Current directory
markdownlint-cli2 --fix "**/*.md" # Fix all files
markdownlint-cli2 --fix README.md # Fix single file
cat README.md | markdownlint-cli2 -
markdownlint-cli2 "**/*.md"markdownlint-cli2 --fix "**/*.md"markdownlint-cli2 "**/*.md"git diffgit add .git commit -m "Backup before markdownlint fix"markdownlint-cli2 --fix "**/*.md"git diffgit add . && git commit -m "Apply markdownlint fixes"For maximum compatibility:
markdownlint-cli2 "**/*.md"# for negation: markdownlint-cli2 "**/*.md" "#vendor" (not !)docs/**/*.md (works on all platforms)markdownlint-cli2 -- "special-file.md".md vs .markdown)markdownlint-cli2 --fix "**/*.md"--config to explicitly specify the filenpm install -g markdownlint-cli2 # npm
brew install markdownlint-cli2 # Homebrew
markdownlint-cli2 --help # Verify installation