eslint-plugin-markdown-preferences
A specialized ESLint plugin that helps enforce consistent writing style and formatting conventions in Markdown files. Perfect for documentation projects, blog posts, and any Markdown content where consistency matters.

π Features
- π Comprehensive style enforcement
Enforces consistent heading casing, table header casing, inline code/link usage, emoji notation, and more for unified document style.
- π§© Powerful formatting consistency
Strongly standardizes Markdown formatting: whitespace, indentation, spacing, line breaks, list markers, code fences, links, references, thematic breaks, tables, and decorative elementsβensuring documents are clean and uniform.
- π Extended Markdown syntax support
Supports custom containers, mathematical expressions, and other extended syntax for high compatibility with VitePress.
- π§ Auto-fix support
Most rules support ESLint's
--fix option for automatic correction.
- π Online Demo & Documentation
Try it instantly in the Online Demo and see full documentation.
π Documentation
For detailed usage instructions, rule configurations, and examples, visit our comprehensive documentation site.
πΏ Installation
npm install --save-dev eslint @eslint/markdown eslint-plugin-markdown-preferences
π Usage
Configuration
New Config (eslint.config.js)
Use eslint.config.js file to configure rules. See also: https://eslint.org/docs/latest/use/configure/configuration-files-new.
Example eslint.config.js:
import { defineConfig } from "eslint/config";
import markdownPreferences from "eslint-plugin-markdown-preferences";
export default defineConfig([
markdownPreferences.configs.recommended,
{
files: ["**/*.md", "*.md"],
rules: {
},
},
]);
This plugin provides configs:
*.configs.recommended ... Recommended config provided by the plugin.
*.configs.standard ... Enforces opinionated stylistic conventions. You can extend this to enforce any stylistic conventions you like.
See the rule list to get the rules that this plugin provides.
Using Extended Syntax
This plugin experimentally supports some extended Markdown syntax.
To use these extended syntaxes, set the markdown-preferences/extended-syntax language option.
import { defineConfig } from "eslint/config";
import markdownPreferences from "eslint-plugin-markdown-preferences";
export default defineConfig([
{
extends: [markdownPreferences.configs.recommended],
language: "markdown-preferences/extended-syntax",
},
]);
The following syntaxes are supported:
Legacy Config (.eslintrc)
Is not supported.
β
Rules
The --fix option on the command line automatically fixes problems reported by rules which have a wrench π§ below.
The rules with the following β are included in the recommended config.
The rules with the following π are included in the standard config.
Preference Rules
- Rules to unify the expression and description style of documents.
Notation Rules
- Rules related to notation styles in Markdown.
Whitespace Rules
- Rules related to whitespace styles in Markdown.
Decorative Rules
- Rules related to visual or stylistic decorations in Markdown.
π« Related Packages
π» Contributing
Welcome contributing!
Please use GitHub's Issues/PRs.
Development Tools
npm test runs tests and measures coverage.
npm run update runs in order to update readme and recommended configuration.
π License
See the LICENSE file for license rights and limitations (MIT).