A Node.js style checker and lint tool for Markdown/CommonMark files.
[![npm version][npm-image]][npm-url] [![License][license-image]][license-url]
npm install markdownlint --save-dev
The Markdown markup language is designed to be easy to read, write, and understand. It succeeds - and its flexibility is both a benefit and a drawback. Many styles are possible, so formatting can be inconsistent; some constructs don't work well in all parsers and should be avoided.
markdownlint is a static analysis tool for
Node.js with a library of rules to enforce standards and consistency
for Markdown files. It was inspired by - and heavily influenced by - Mark
Harrison's markdownlint for Ruby. The initial rules, rule
documentation, and test cases came from that project.
markdownlint uses the micromark parser and honors the
CommonMark specification for Markdown. It additionally supports
popular GitHub Flavored Markdown (GFM) syntax like autolinks and tables
as well as directives, footnotes, and math syntax - all implemented by
micromark extensions. (Note that inline directives are
not supported to avoid confusion due to over-matching.)
The following specifications are considered authoritative in cases of ambiguity:
markdownlint demo, an interactive, in-browser
playground for learning and exploring.
See Rules.md for more details.
In addition to built-in rules, custom rules can be used to address
project-specific requirements. To find community-developed rules use
keyword markdownlint-rule on npm.
To implement your own rules, refer to CustomRules.md.
Tags group related rules and can be used to enable/disable multiple rules at once.
accessibility - MD045, MD059atx - MD018, MD019atx_closed - MD020, MD021blank_lines - MD012, MD022, MD031, MD032, MD047blockquote - MD027, MD028bullet - MD004, MD005, MD007, MD032code - MD014, MD031, MD038, MD040, MD046, MD048emphasis - MD036, MD037, MD049, MD050hard_tab - MD010headings - MD001, MD003, MD018, MD019, MD020, MD021,
MD022, MD023, MD024, MD025, MD026, MD036, MD041, MD043hr - MD035html - MD033images - MD045, MD052, MD053, MD054indentation - MD005, MD007, MD027language - MD040line_length - MD013links - MD011, MD034, MD039, MD042, MD051, MD052, MD053,
MD054, MD059ol - MD029, MD030, MD032spaces - MD018, MD019, MD020, MD021, MD023spelling - MD044table - MD055, MD056, MD058, MD060ul - MD004, MD005, MD007, MD030, MD032url - MD034whitespace - MD009, MD010, MD012, MD027, MD028, MD030,
MD037, MD038, MD039Text passed to markdownlint is parsed as Markdown, analyzed, and any
issues reported. Two kinds of text are ignored by most rules:
options.frontMatter below)All rules are enabled by default. Rules can be enabled, disabled, and configured
for each call to the lint API by passing an options.config object (described
below). To enable or disable rules within a file, use one of the following HTML
comments (which are not rendered):
For example:
space * in * emphasis
Or:
space * in * emphasis
Or:
space * in * emphasis
To temporarily disable rule(s), then restore the former configuration:
any violations you want
The initial configuration is captured by default (as if every document began with ``), so the pattern above can be expressed more simply:
any violations you want
Changes take effect starting with the line a comment is on, so the following has no effect:
space * in * emphasis
To apply changes to an entire file regardless of where the comment is located, the following syntax is supported:
This can be used to "hide" markdownlint comments at the bottom of a file.
In cases where it is desirable to change the configuration of one or more rules for a file, the following more advanced syntax is supported:
For example:
or
```markdown <!-- markdownlint-configure-file { "hr-s
$ claude mcp add markdownlint \
-- python -m otcore.mcp_server <graph>