eslint-plugin-md

raw JSON →
1.0.19 verified Sat Apr 25 auth: no javascript

An ESLint plugin for linting and fixing Markdown files using remark-lint under the hood. Version 1.0.19 is the latest stable release, with no regular release cadence. Unlike eslint-plugin-markdown (which only lints JavaScript inside markdown), eslint-plugin-md lints the markdown content itself, supporting style enforcement and integration with prettier. It provides a single ESLint rule 'md/remark' that wraps remark-lint rules, and requires a custom parser 'markdown-eslint-parser'.

error ESLint couldn't find the plugin "eslint-plugin-md".
cause Plugin not installed or not loaded correctly in ESLint config.
fix
Run npm install eslint-plugin-md --save-dev and ensure extends includes 'plugin:md/recommended'.
error Configuration for rule "md/remark" is invalid: Value "[object Object]" is not a valid severity.
cause Rule configuration passed incorrectly (maybe extra array nesting).
fix
Set rule as 'md/remark': ['error', { /* options */ }] (array with two elements).
error Error: Cannot find module 'markdown-eslint-parser'
cause markdown-eslint-parser not installed.
fix
Run npm install markdown-eslint-parser --save-dev.
gotcha By default ESLint does not lint .md files; must use --ext js,md on CLI or configure VSCode.
fix Add --ext js,md to eslint command or set eslint.validate to ['markdown'] in VSCode settings.
gotcha Parser 'markdown-eslint-parser' must be set in an overrides section for '*.md' files only, not globally.
fix Use overrides with files: ['*.md'] and parser: 'markdown-eslint-parser' inside that override.
gotcha The plugin exports a single rule 'md/remark'; custom remark options are passed as second argument to that rule.
fix Configure rule as 'md/remark': ['error', { /* remark options */ }].
gotcha JS code within fenced code blocks in .md files is linted with the same base ESLint config unless overridden.
fix Add an override for files: ['*.md.js'] to apply different rules for JS snippets inside markdown.
npm install eslint-plugin-md
yarn add eslint-plugin-md
pnpm add eslint-plugin-md

Minimal setup to lint markdown files with default remark rules using eslint-plugin-md.

// Install dependencies
npm install eslint eslint-plugin-md markdown-eslint-parser --save-dev

// .eslintrc.js
module.exports = {
  extends: ['plugin:md/recommended'],
  overrides: [
    {
      files: ['*.md'],
      parser: 'markdown-eslint-parser',
    },
  ],
};

// Lint markdown files (CLI)
eslint . --ext js,md