Registry / testing / markdown-eslint-parser

markdown-eslint-parser

JSON →
library1.2.1jsnpmunverified

markdown-eslint-parser is a custom ESLint parser designed to enable linting of `.md` (Markdown) files, primarily in conjunction with `eslint-plugin-md`. Unlike standard parsers that generate a full AST for the parsed language, this package uniquely returns an empty JavaScript AST with a special `mdCode` property containing the raw Markdown content as a string. This allows `eslint-plugin-md` to process the Markdown itself using tools like `remark-lint`. The current stable version is 1.2.1. Given the recent introduction and active development of the official `@eslint/markdown` (which offers integrated parsing and rules for CommonMark and GitHub-Flavored Markdown) and the last update of its primary companion `eslint-plugin-md` dating back about two years, `markdown-eslint-parser` should be considered superseded for new projects. It maintains a niche for existing setups reliant on `eslint-plugin-md`.

npm install markdown-eslint-parser
INSTALL
IMPORT
SIG · MARKDOWN-ESLINT-PA
M
markdown-eslint-parser
testingjavascriptv1.2.1
Install
Import
Disk
Pass rate
0/ 6
Env Coverage0 / 6
glibc
1822
musl
1822
Install & Compatibility
Where this runs
tested against v? · npm install
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
node 18226 runs
build_error
glibc
node 18226 runs
build_error
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

parser
module.exports = { overrides: [ { files: ['*.md'], parser: 'markdown-eslint-parser', }, ], };
This package is configured directly in `.eslintrc` and does not provide direct JavaScript exports for runtime import. It functions as an ESLint parser within the ESLint configuration system.

Demonstrates how to configure `markdown-eslint-parser` in a legacy `.eslintrc.js` file for linting `.md` files alongside `eslint-plugin-md`, and how to lint JavaScript code blocks within Markdown.

yarn add -D eslint markdown-eslint-parser eslint-plugin-md // .eslintrc.js (for legacy ESLint configurations) module.exports = { extends: [ // ... other configs (e.g., 'eslint:recommended', 'plugin:md/recommended') ], overrides: [ { files: ['*.md'], // This parser extracts Markdown content for 'eslint-plugin-md'. // It doesn't produce a JS AST for the Markdown itself. parser: 'markdown-eslint-parser', rules: { // Example: If using eslint-plugin-md, configure its rules here // 'md/remark': 'error', }, }, { // This block targets JavaScript code blocks *within* Markdown files // for standard JavaScript linting. Requires eslint-plugin-markdown. files: ['**/*.md/*.js'], rules: { 'no-console': 'off', // Example: Relax rules for code snippets }, }, ], }; // To run ESLint from CLI (for legacy config): // eslint . --ext js,md
Debug
Known issues
deprecatedThis package, along with its primary companion `eslint-plugin-md`, is no longer actively maintained and has been largely superseded by the official `@eslint/markdown` package. New projects should consider using the official solution for more robust and current Markdown linting capabilities.
fix
For new projects or migration, install `@eslint/markdown` and configure it in your `eslint.config.js` (for ESLint v9+) or `.eslintrc` (for older ESLint) as per its documentation. E.g., `npm install @eslint/markdown -D` then `import markdown from '@eslint/markdown'; export default [{ files: ['**/*.md'], plugins: { markdown }, language: 'markdown/commonmark', rules: { 'markdown/no-html': 'error' } }];`
affects: >=1.0.0
gotchaThis parser itself does not provide Markdown linting rules; it only makes the Markdown content available. You must also install and configure `eslint-plugin-md` (the intended companion) to apply actual Markdown-specific linting rules.
fix
Ensure `eslint-plugin-md` is installed (`yarn add -D eslint-plugin-md`) and its recommended configuration or specific rules are extended/applied in your `.eslintrc` alongside this parser.
affects: >=1.0.0
gotchaWhen using ESLint v8 or older with `.eslintrc` files, ESLint does not automatically lint `.md` files. You need to explicitly tell ESLint to include them, either via CLI `--ext` option or your editor's ESLint plugin settings.
fix
Run ESLint with `eslint . --ext js,md` or configure your VSCode ESLint extension with `"eslint.validate": ["javascript", "typescript", "markdown"]`.
affects: <=8.x
breakingThis package is designed for legacy ESLint configuration formats (`.eslintrc.js`). It may not be compatible or easily configurable with ESLint v9 and its new flat configuration (`eslint.config.js`) system without significant workarounds, especially given the official `@eslint/markdown` now exists for flat config.
fix
If migrating to ESLint v9, it's strongly recommended to switch to the official `@eslint/markdown` plugin, which is built for the flat config system. Example for ESLint v9: `import markdown from '@eslint/markdown'; export default [{ files: ['**/*.md'], plugins: { markdown }, language: 'markdown/commonmark' }];`
affects: >=1.0.0 (in context of ESLint v9+)
Errors
Common errors & fixes
Error: Cannot find module 'markdown-eslint-parser'
The package `markdown-eslint-parser` was not installed or is not resolvable by ESLint.
fix
Ensure `markdown-eslint-parser` is listed in your `devDependencies` and run `npm install` or `yarn install`.
ESLint: No files were linted.
ESLint is not configured to process `.md` files or the command line execution is not including them.
fix
If using an `.eslintrc` file, ensure ESLint is run with `--ext .md` (e.g., `eslint . --ext js,md`). If using VSCode, add `"eslint.validate": ["markdown"]` to your settings. If using ESLint v9 with `eslint.config.js`, verify `files: ['**/*.md']` is correctly set in your configuration.
ESLint: Cannot read config file: .eslintrc.js Error: ESLint was configured to use the parser 'markdown-eslint-parser' which was not found.
The parser is correctly referenced in `.eslintrc.js` but the package is not installed or accessible to ESLint.
fix
Check your `package.json` for `markdown-eslint-parser` in `devDependencies` and reinstall packages. Verify `node_modules` is present and accessible.
Upgrade
Version history
1.2.1latest on npm
Audit
Dependencies
eslint-plugin-mdoptionalThis parser is primarily designed to be used with `eslint-plugin-md` for actual Markdown content linting. Without it, the parser alone only provides raw Markdown string.
eslintrequiredRuntime dependency for any ESLint parser or plugin.
Agent activity
2 hits · last 30 days
node
2
Resources
markdown-eslint-parser — npm install markdown-eslint-parser · libregistry