Gathering detailed insights and metrics for @eslint/markdown
Gathering detailed insights and metrics for @eslint/markdown
Gathering detailed insights and metrics for @eslint/markdown
Gathering detailed insights and metrics for @eslint/markdown
eslint-plugin-markdown
An ESLint plugin to lint JavaScript in Markdown code fences.
@types/eslint-plugin-markdown
TypeScript definitions for eslint-plugin-markdown
markdown-eslint-parser
The ESLint custom parser for *.md files.
eslint-formatter-markdown
Markdown ESLint formatter (reporter)
Lint JavaScript code blocks in Markdown documents
npm install @eslint/markdown
Typescript
Module System
Min. Node Version
Node Version
NPM Version
97.4
Supply Chain
97.6
Quality
91
Maintenance
100
Vulnerability
100
License
JavaScript (96.24%)
TypeScript (3.61%)
Shell (0.14%)
Total Downloads
4,688,250
Last Day
15,522
Last Week
202,121
Last Month
800,633
Last Year
4,688,250
MIT License
472 Stars
367 Commits
73 Forks
21 Watchers
12 Branches
42 Contributors
Updated on Jul 03, 2025
Minified
Minified + Gzipped
Latest Version
6.6.0
Package Id
@eslint/markdown@6.6.0
Unpacked Size
120.50 kB
Size
27.45 kB
File Count
7
NPM Version
10.9.2
Node Version
22.16.0
Published on
Jun 20, 2025
Cumulative downloads
Total Downloads
Last Day
24%
15,522
Compared to previous day
Last Week
6.2%
202,121
Compared to previous week
Last Month
6.2%
800,633
Compared to previous month
Last Year
0%
4,688,250
Compared to previous year
8
Lint Markdown with ESLint, as well JS, JSX, TypeScript, and more inside Markdown.
Install the plugin alongside ESLint v9 or greater.
For Node.js and compatible runtimes:
1npm install @eslint/markdown -D 2# or 3yarn add @eslint/markdown -D 4# or 5pnpm install @eslint/markdown -D 6# or 7bun add @eslint/markdown -D
For Deno:
1deno add jsr:@eslint/markdown
Configuration Name | Description |
---|---|
recommended | Lints all .md files with the recommended rules and assumes CommonMark format. |
processor | Enables extracting code blocks from all .md files so code blocks can be individually linted. |
In your eslint.config.js
file, import @eslint/markdown
and include the recommended config to enable Markdown parsing and linting:
1// eslint.config.js 2import { defineConfig } from "eslint/config"; 3import markdown from "@eslint/markdown"; 4 5export default defineConfig([ 6 markdown.configs.recommended 7 8 // your other configs here 9]);
You can also modify the recommended config by using extends
:
1// eslint.config.js 2import { defineConfig } from "eslint/config"; 3import markdown from "@eslint/markdown"; 4 5export default defineConfig([ 6 { 7 plugins: { 8 markdown 9 }, 10 extends: ["markdown/recommended"], 11 rules: { 12 "markdown/no-html": "error" 13 } 14 } 15 16 // your other configs here 17]);
Rule Name | Description | Recommended |
---|---|---|
fenced-code-language | Require languages for fenced code blocks | yes |
heading-increment | Enforce heading levels increment by one | yes |
no-bare-urls | Disallow bare URLs | no |
no-duplicate-definitions | Disallow duplicate definitions | yes |
no-duplicate-headings | Disallow duplicate headings in the same document | no |
no-empty-definitions | Disallow empty definitions | yes |
no-empty-images | Disallow empty images | yes |
no-empty-links | Disallow empty links | yes |
no-html | Disallow HTML tags | no |
no-invalid-label-refs | Disallow invalid label references | yes |
no-missing-atx-heading-space | Disallow headings without a space after the hash characters | yes |
no-missing-label-refs | Disallow missing label references | yes |
no-missing-link-fragments | Disallow link fragments that do not reference valid headings | yes |
no-multiple-h1 | Disallow multiple H1 headings in the same document | yes |
no-reversed-media-syntax | Disallow reversed link and image syntax | yes |
require-alt-text | Require alternative text for images | yes |
table-column-count | Disallow data rows in a GitHub Flavored Markdown table from having more cells than the header row | yes |
Note: This plugin does not provide formatting rules. We recommend using a source code formatter such as Prettier for that purpose.
In order to individually configure a rule in your eslint.config.js
file, import @eslint/markdown
and configure each rule with a prefix:
1// eslint.config.js 2import { defineConfig } from "eslint/config"; 3import markdown from "@eslint/markdown"; 4 5export default defineConfig([ 6 { 7 files: ["**/*.md"], 8 plugins: { 9 markdown 10 }, 11 language: "markdown/commonmark", 12 rules: { 13 "markdown/no-html": "error" 14 } 15 } 16]);
You can individually disable rules in Markdown using HTML comments, such as:
1<!-- eslint-disable-next-line markdown/no-html -- I want to allow HTML here --> 2<custom-element>Hello world!</custom-element> 3 4<!-- eslint-disable markdown/no-html -- here too --> 5<another-element>Goodbye world!</another-element> 6<!-- eslint-enable markdown/no-html -- safe to re-enable now --> 7 8[Object] <!-- eslint-disable-line markdown/no-missing-label-refs -- not meant to be a link ref -->
Language Name | Description |
---|---|
commonmark | Parse using CommonMark Markdown format |
gfm | Parse using GitHub-Flavored Markdown format |
In order to individually configure a language in your eslint.config.js
file, import @eslint/markdown
and configure a language
:
1// eslint.config.js 2import { defineConfig } from "eslint/config"; 3import markdown from "@eslint/markdown"; 4 5export default defineConfig([ 6 { 7 files: ["**/*.md"], 8 plugins: { 9 markdown 10 }, 11 language: "markdown/gfm", 12 rules: { 13 "markdown/no-html": "error" 14 } 15 } 16]);
commonmark
and gfm
By default, Markdown parsers do not support front matter. To enable front matter in both commonmark
and gfm
, you can use the frontmatter
option in languageOptions
.
@eslint/markdown
internally usesmicromark-extension-frontmatter
andmdast-util-frontmatter
to parse front matter.
Option Value | Description |
---|---|
false | Disables front matter parsing in Markdown files. (Default) |
"yaml" | Enables YAML front matter parsing in Markdown files. |
"toml" | Enables TOML front matter parsing in Markdown files. |
"json" | Enables JSON front matter parsing in Markdown files. |
1// eslint.config.js
2import { defineConfig } from "eslint/config";
3import markdown from "@eslint/markdown";
4
5export default defineConfig([
6 {
7 files: ["**/*.md"],
8 plugins: {
9 markdown
10 },
11 language: "markdown/gfm",
12 languageOptions: {
13 frontmatter: "yaml", // Or pass `"toml"` or `"json"` to enable TOML or JSON front matter parsing.
14 },
15 rules: {
16 "markdown/no-html": "error"
17 }
18 }
19]);
Processor Name | Description |
---|---|
markdown | Extract fenced code blocks from the Markdown code so they can be linted separately. |
vscode-eslint
has built-in support for the Markdown processor.
This processor will use file names from blocks if a filename
meta is present.
For example, the following block will result in a parsed file name of src/index.js
:
1```js filename="src/index.js" 2export const value = "Hello, world!"; 3```
This can be useful for user configurations that include linting overrides for specific file paths. In this example, you could then target the specific code block in your configuration using "file-name.md/*src/index.js"
.
1$ git clone https://github.com/eslint/markdown.git 2$ cd markdown 3$ npm install 4$ npm test
This project follows the ESLint contribution guidelines.
The following companies, organizations, and individuals support ESLint's ongoing maintenance and development. Become a Sponsor to get your logo on our READMEs and website.
No vulnerabilities found.
No security vulnerabilities found.