Skip to content

A collection of custom rules for markdownlint that enforce consistent Markdown styling and formatting standards.

License

Notifications You must be signed in to change notification settings

kynoptic/markdownlint-trap

Repository files navigation

markdownlint-trap

A collection of custom rules for markdownlint that enforce consistent Markdown styling and formatting standards.

Key features

  • 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

Installation

npm install markdownlint-trap

Requirements

  • Node.js (v14 or higher)
  • Use nvm to load the version from .nvmrc:
nvm install
nvm use
  • markdownlint (v0.38.0 or compatible)

Usage

Custom rules

Add the custom rules to your .markdownlint-cli2.jsonc file:

{
  "customRules": [
    "markdownlint-trap"
  ],
  "config": {
    "sentence-case-heading": true,
    "backtick-code-elements": true
  }
}

Run with custom rules

npx markdownlint-cli2 "**/*.md"

Testing

Run the tests with:

npm test

Use DEBUG=markdownlint-trap* for verbose output.

License and attribution

This project is licensed under the MIT License - see the LICENSE file for details.

Resources

About

A collection of custom rules for markdownlint that enforce consistent Markdown styling and formatting standards.

Topics

Resources

License

Stars

Watchers

Forks