markdownlint-cli2 validates Markdown files against configurable style and structure rules.
It helps keep the repository documentation consistent as the number of Markdown files grows.
The tool is installed through Homebrew and declared in the project Brewfile.
It is part of the curated Homebrew environment; see Homebrew setup to install everything at once.
Install markdownlint-cli2 directly:
brew install markdownlint-cli2Verify the installation:
markdownlint-cli2 --version
brew list --formula | grep -x markdownlint-cli2The repository configuration is declared in:
.markdownlint-cli2.yaml
Current configuration:
config:
MD013: falseThe MD013 line-length rule is disabled because enforcing an 80-character
limit would make the documentation unnecessarily difficult to maintain.
Other Markdown rules remain enabled.
Check all Markdown files:
markdownlint-cli2 "**/*.md"Check selected files:
markdownlint-cli2 README.md docs/**/*.mdApply supported automatic fixes:
markdownlint-cli2 --fix "**/*.md"Automatic fixes should be reviewed before being committed.
The repository runs markdownlint-cli2 through pre-commit.
The hook is configured as a local system hook:
- id: markdownlint-cli2
name: markdownlint-cli2
entry: markdownlint-cli2
language: system
types: [markdown]Run only this hook:
pre-commit run markdownlint-cli2 --all-filesmarkdownlint can detect issues such as:
- inconsistent heading levels;
- missing blank lines around lists or headings;
- repeated blank lines;
- malformed fenced code blocks;
- inconsistent list markers;
- missing language identifiers on code fences;
- trailing punctuation or spacing problems.
The exact active rules depend on the repository configuration.
Run the checker and review the reported file and line number:
markdownlint-cli2 "**/*.md"For automatically fixable issues:
markdownlint-cli2 --fix "**/*.md"Then inspect the changes:
git diffDo not disable a rule globally when a local documentation issue can be fixed cleanly.
Any rule change should be:
- motivated by the repository's actual writing style;
- applied narrowly;
- documented when it affects contributors;
- tested against all Markdown files.
Avoid disabling multiple rules simply to make the checker pass.
markdownlint-cli2 validates Markdown structure and style.
Lychee validates links found inside Markdown files.
Both tools are complementary:
markdownlint-cli2 "**/*.md"
lychee README.md 'docs/**/*.md'Display the available options:
markdownlint-cli2 --helpConfirm the executable path:
command -v markdownlint-cli2Validate only the repository README:
markdownlint-cli2 README.mdIf a configuration change is not applied, confirm that
.markdownlint-cli2.yaml exists at the repository root.
After an update, rerun the complete documentation check because new rules or rule behavior may be introduced.
Remove markdownlint-cli2 with Homebrew:
brew uninstall markdownlint-cli2Then remove:
- its entry from
profiles/full/Brewfile; - its hook from
.pre-commit-config.yaml; .markdownlint-cli2.yamlif no other Markdown tooling uses it.
