A collection of custom rules for markdownlint that enforce consistent Markdown styling and formatting standards.
- Sentence case heading rule (
sentence-case-heading
) – Ensures headings follow sentence case style (only first word capitalized) - Backtick code elements rule (
backtick-code-elements
) – Enforces backticks around code snippets and paths - Test-driven development approach with comprehensive fixture-based testing
- Detailed error messages to help users understand and fix violations
- Smart detection of acronyms, proper nouns, and code elements
npm install markdownlint-trap
- Node.js (v
14
or higher) - Use
nvm
to load the version from.nvmrc
:
nvm install
nvm use
- markdownlint (v
0.38.0
or compatible)
Add the custom rules to your .markdownlint-cli2.jsonc
file:
{
"customRules": [
"markdownlint-trap"
],
"config": {
"sentence-case-heading": true,
"backtick-code-elements": true
}
}
npx markdownlint-cli2 "**/*.md"
Run the tests with:
npm test
Use DEBUG=markdownlint-trap*
for verbose output.
This project is licensed under the MIT License - see the LICENSE file for details.
docs/reference/rules.md
– Detailed rule documentationtests/
– Test fixtures and examplesCHANGELOG.md
– Version history and changes