Lint Markdown and MDC files with markdownlint. MDC Lint ships a CLI and an ESLint flat-config plugin tuned for Nuxt Content style Markdown.
- CLI with glob support and
--fix - ESLint plugin with recommended rules for Markdown/MDC
- Presets:
mdc(default) with custom MDC rules, ormarkdownfor plain Markdown - Respects existing
.markdownlint.*config files and supplies sane defaults
# with npm
npm install -D mdclint
# with pnpm
pnpm add -D mdclintLint files directly from the terminal:
npx mdclint "content/**/*.md"Options:
--preset [mdc|markdown](default:mdc) — use MDC-specific rules or standard Markdown rules only.--fix— apply autofixable markdownlint suggestions in-place.
The CLI:
- Accepts files or glob patterns and expands directories automatically.
- Loads the first
.markdownlint.*config it finds in the project root; if none exists, it uses a default config that disables some noisy markdownlint rules (e.g.MD041, table line length) and enables MDC-specific rules (MDC007,MDC018,MDC022,MDC023,MDC031,MDC032,MDC034,MDC058).
Examples:
# Lint all docs using the MDC preset
npx mdclint docs/**/*.md
# Lint plain Markdown and apply fixes
npx mdclint README.md --preset markdown --fixUse MDC Lint as part of your flat ESLint config:
// eslint.config.mjs
import { createConfigForNuxt } from '@nuxt/eslint-config/flat'
import { mdcLint } from 'mdclint'
export default createConfigForNuxt({})
.append(await mdcLint({
files: ['content/**/*.md'], // defaults to ['**/*.md']
preset: 'mdc', // or 'markdown'
config: { MD013: { line_length: 100 } } // optional markdownlint overrides
}))What the plugin provides:
- Recommended rules under the
mdclint/*namespace (all enabled aserrorby default). - A parser stub compatible with Markdown files.
- Support for
.markdownlint.*configs; passconfigto override rules inline, orpreset: 'markdown'to disable MDC-specific rules.
- MDC Lint will load the first
.markdownlint.*file in your project root (.yaml,.yml,.json,.js,.cjs, etc.). - Built-in defaults loosen some markdownlint rules for content sites (e.g. allow
missing top-level header, ignore table line length) and add MDC-specific checks.
Override any rule in your config or via the plugin’s
configoption. - Use
preset: 'markdown'(CLI flag or plugin option) to lint plain Markdown without MDC custom rules.
pnpm install # install dependencies
pnpm lint # run ESLint
pnpm prepack # build the packageMDC Lint is built on top of markdownlint and inspired by: