Linters
What is markdownlint? An introduction to David Anson's Markdown linter
markdownlint is a Node.js style checker and lint tool for Markdown and CommonMark files. It is a static analysis tool that applies a library of rules to enforce standards and consistency in Markdown documents. It is installed through npm as a development dependency.
- Tool
- markdownlint
- Made by
- David Anson
- Official site
- github.com/DavidAnson/markdownlint
- Category
- Linters
Who makes markdownlint
markdownlint is made by David Anson. The official website is the project's GitHub repository, linked below.
The project was inspired by Mark Harrison's markdownlint for Ruby. The initial rules, documentation and tests came from that earlier tool.
Official website: github.com/DavidAnson/markdownlint
What markdownlint is for
markdownlint checks Markdown files against a set of style rules so that documents follow a shared standard. Because it is a static analysis tool, it inspects the text of the files rather than running or rendering anything.
It parses Markdown with the micromark parser and follows the CommonMark specification. Its checks are therefore based on how the document is actually structured, not on loose pattern matching. Built-in rules cover areas such as heading increments, line length, trailing spaces and inline HTML.
Who markdownlint is for
The vendor does not state a target audience. Given what the tool does, it is relevant to anyone who keeps Markdown files in a project and wants them to stay consistent, such as maintainers of documentation, README files and other written content stored alongside code.
Because it installs through npm as a development dependency, it sits naturally in Node.js projects. The command-line interfaces, editor integrations and build-tool integrations also make it usable outside of a Node.js codebase.
Notable capabilities
markdownlint combines a rule library with several ways to run it and to adjust its behavior. These are the capabilities described in the project's verified facts.
- Rule library: built-in rules cover areas such as heading increments, line length, trailing spaces and inline HTML, and all rules are enabled by default.
- Configuration: rules can be configured for each lint call through an options.config object, and tags group related rules so several can be enabled or disabled at once.
- In-file control: rules can be toggled inside a Markdown file by using HTML comments.
- Custom rules: project-specific requirements can be covered by writing custom rules.
- Syntax support: through micromark extensions it handles GitHub Flavored Markdown syntax such as autolinks and tables, plus directives, footnotes and math.
- Command-line tools: markdownlint-cli and markdownlint-cli2 are available and work with pre-commit, and a GitHub Action exists for running markdownlint-cli2.
- Editor integrations: extensions exist for VS Code, Sublime Text, Vim/Neovim and Emacs.
- Interactive playground: an in-browser demo is available for learning and exploring the rules.
How markdownlint fits linters
Most linters focus on source code. markdownlint applies the same idea to prose files written in Markdown, checking structure and style rather than program logic. In a collection of linters it covers the documentation side of a repository.
It also integrates with other tooling such as ESLint, Grunt, Cake and MSBuild. That lets Markdown checks run alongside the code checks a project already has, so documentation and code can be linted in the same workflow.
Frequently asked questions
What is markdownlint used for?
markdownlint is used to check Markdown and CommonMark files against a library of rules that enforce standards and consistency. Examples include heading increments, line length, trailing spaces and inline HTML.
Who develops markdownlint?
markdownlint is made by David Anson. It was inspired by Mark Harrison's markdownlint for Ruby, which supplied the initial rules, docs and tests.
Does markdownlint support GitHub Flavored Markdown?
Yes. It supports GitHub Flavored Markdown syntax such as autolinks and tables, along with directives, footnotes and math, through micromark extensions.
Can I turn markdownlint rules off?
Yes. All rules are enabled by default, but you can configure them per lint call with an options.config object, group them with tags, or toggle them inside a Markdown file using HTML comments.
Linthelm is independent and is not affiliated with David Anson. Product names belong to their owners. Features change; confirm details on the official website.