iTechGuides is reader-supported. When you buy through links on our site, we may earn an affiliate commission. As an Amazon Associate I earn from qualifying purchases. Learn more
To lint Markdown with ESLint, install the official @eslint/markdown package and add its recommended configuration to your flat config. To lint JavaScript code blocks inside Markdown, use the package’s processor configuration instead. They do different jobs: a processor-based run checks extracted code blocks, not the Markdown prose. To check both, configure and run ESLint twice.
How do I lint Markdown with ESLint?
Use the official @eslint/markdown package with ESLint’s flat configuration. The package README requires ESLint v9.15.0 or later; flat config has been ESLint’s default format since v9.0.0. Install both packages if ESLint is not already a project dependency:
npm install --save-dev eslint @eslint/markdown
If ESLint is already installed, add only the plugin:
Quick wins for a faster PC:
Clear out junk files and repair common Windows errorsFree Scan →Fix the driver behind crashes, sound loss and screen glitchesFind Drivers →Repair Windows errors before they cause bigger problemsFix Now →npm install --save-dev @eslint/markdown
In eslint.config.js, add the plugin’s recommended config to lint Markdown document content:
#1 Best Overall
import markdown from "@eslint/markdown";
export default [
...markdown.configs.recommended,
];
The recommended config applies Markdown language support and recommended Markdown-specific rules to .md files. Examples include checks for heading increments, alt text, table column counts, spacing in emphasis, and unused definitions. It assumes CommonMark, so use a different language configuration when your documents use another dialect.
Run ESLint against the Markdown files or directories you want to check, for example:
npx eslint "docs/**/*.md"
Use the glob that matches your project. The configuration applies to Markdown files; the command’s path pattern determines which files ESLint receives.
Do these 3 things before closing this tab:
1Scan for outdated or missing drivers - takes under a minute2Repair Windows errors before they cause bigger problems3Fix the driver behind crashes, sound loss and screen glitchesHow do I lint JavaScript code blocks in Markdown with ESLint?
Use the markdown/processor configuration to extract fenced code blocks into virtual files. ESLint then applies its ordinary configuration to those files, so your JavaScript rules must match the virtual JavaScript filenames.
A processor configuration can look like this:
import markdown from "@eslint/markdown";
export default [
{
...markdown.configs.processor,
files: ["**/*.md"],
},
{
files: ["**/*.js"],
rules: {
// Add the JavaScript rules used by your project.
},
},
];
Choose code-block language tags that correspond to extensions covered by your ESLint file patterns. Untagged fences are ignored. The processor maps javascript and ecmascript to .js, typescript to .ts, and markdown to .md. For example, a fence marked js should not be assumed to match the documented javascript mapping.
```javascript
const message = "Hello";
```
With the processor configuration in place, run ESLint on the Markdown files:
Rank #3
npx eslint "docs/**/*.md"
How can I lint both Markdown prose and fenced code?
The processor and recommended configuration are not interchangeable, and applying the processor means that run checks extracted code blocks rather than Markdown content. The documented approach for checking both is to define separate configurations and invoke ESLint twice.
The Tool Desk
Outbyte Driver Updater FREEScan for outdated or missing drivers - takes under a minuteDriver Scan →Outbyte PC Repair FREERepair Windows errors before they cause bigger problemsFix Now →Keep the Markdown-content configuration in one flat-config file, such as eslint.markdown.config.js:
import markdown from "@eslint/markdown";
export default [
...markdown.configs.recommended,
];
Put the processor and the project’s code rules in a second file, such as eslint.codeblocks.config.js:
import markdown from "@eslint/markdown";
export default [
{
...markdown.configs.processor,
files: ["**/*.md"],
},
{
files: ["**/*.js"],
rules: {
// Add the JavaScript rules used by your project.
},
},
];
Run each configuration against the Markdown files:
npx eslint --config eslint.markdown.config.js "docs/**/*.md"
npx eslint --config eslint.codeblocks.config.js "docs/**/*.md"
Use the same approach for TypeScript or other supported code by adding rules and matching file patterns for the corresponding virtual filenames. The Markdown-content run checks document rules; the processor run checks code extracted from fences.
Which Markdown dialect and extensions should I configure?
CommonMark and GitHub Flavored Markdown
The recommended configuration assumes CommonMark. The plugin also documents GitHub Flavored Markdown (GFM); select GFM explicitly when that is the dialect your repository uses. Do not assume that installing the plugin automatically enables GFM behavior.
Recommended Free Tools
Front matter and math
Parsing for YAML, TOML, and JSON front matter, as well as math parsing, is optional and disabled by default. Enable those language options only if your Markdown files actually contain that syntax, following the package’s configuration documentation.
Best Value
What does the Markdown plugin check—and what does it not do?
Markdown rules inspect document structure and conventions. They can catch issues such as a missing image alt description or inconsistent table columns, but the plugin does not supply formatting rules. The project documentation recommends using a source-code formatter such as Prettier for formatting; treat formatting and linting as separate checks.
For embedded code, ESLint applies code rules to extracted virtual files. A code block is not checked merely because it appears in a Markdown document: it needs a recognized language tag and a matching ESLint file pattern.
What if an older guide uses eslint-plugin-markdown?
eslint-plugin-markdown is the older package name found in legacy guides. For a current setup, use @eslint/markdown and flat config. The official package README includes migration guidance for projects moving from the older package.
PC Slower Than It Used to Be?
A free scan shows the junk files, broken settings and background clutter dragging Windows down - then fixes them in one click.Free scan · Windows 10 & 11Crashes, No Sound, or Screen Glitches?
Random freezes, missing sound and display glitches usually trace back to one bad driver. Find and replace yours safely.Free scan · under a minuteQuick Recap
Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.

