Registry / web-framework / prettier-plugin-mdc

prettier-plugin-mdc

JSON →
library0.2.1jsnpmunverified

A Prettier plugin for formatting MDC (Markdown Components) syntax, as used in Nuxt Content. Current stable version is 0.2.1, released with bug fixes for extra newlines after frontmatter and fallback to mdast embed logic. Requires Prettier >=3.6.0. Ships TypeScript types. Differentiators: supports YAML front matter in components, nested components, GFM, and math syntax. Plugin must be added to Prettier config with the 'mdc' parser explicitly set via overrides. Works with .mdc and .md files.

npm install prettier-plugin-mdc
INSTALL
IMPORT
SIG · PRETTIER-PLUGIN-MD
P
prettier-plugin-mdc
web-frameworkjavascriptv0.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.

plugin
plugins: ['prettier-plugin-mdc']
plugins: ['prettier-plugin-mdc'] // no default or named import needed; configured in prettier config
Not imported in code; added to Prettier config's plugins array. No JS import required.
parser
parser: 'mdc'
parser: 'markdown'
Must set parser to 'mdc' in Prettier overrides for .md or .mdc files. Using 'markdown' parser will not apply MDC-specific formatting.
types (TypeScript)
import type { Options, Plugin } from 'prettier'
import type { Options } from 'prettier-plugin-mdc'
Package ships types but they are internal; use Prettier's own types for configuration. No direct type import from this package.

Shows how to configure Prettier with the MDC plugin, including required overrides for parser, and example CLI usage.

// .prettierrc or prettier.config.js { "plugins": ["prettier-plugin-mdc"], "overrides": [ { "files": ["*.md", "*.mdc"], "options": { "parser": "mdc" } } ] } // CLI: prettier --write "**/*.mdc" "**/*.md" // Example MDC file (before formatting): // ::component{prop=value} // content // :: // After formatting: proper indentation and spacing
Debug
Known issues
breakingPrettier >=3.6.0 required (v0.2.0+ breaks with older prettier)
fix
Upgrade prettier to >=3.6.0
affects: <3.6.0
gotchaParser must be set to 'mdc' in overrides; using default 'markdown' parser will not format MDC syntax correctly
fix
Add override: { files: ['*.md', '*.mdc'], options: { parser: 'mdc' } }
affects: >=0.1.0
gotchaPlugin only formats .mdc and .md files; other file extensions require explicit parser override
fix
Include desired file extensions in the files array of the override
affects: >=0.1.0
deprecatedv0.1.x required prettier 3.6.0+; v0.2.0 made it work with prettier 3.8
fix
Upgrade to v0.2.0+ for prettier 3.8 compatibility
affects: 0.1.0 - 0.1.4
gotchaYAML front matter in components may lose extra newlines if not properly handled; v0.2.1 fixed extra newlines after frontmatter
fix
Upgrade to v0.2.1+
affects: <0.2.1
Errors
Common errors & fixes
Cannot find module 'prettier-plugin-mdc'
Package not installed or not installed as dev dependency
fix
npm install -D prettier-plugin-mdc
Error: No parser and no filepath given, couldn't infer a parser.
Plugin registered but no parser override for .mdc or .md files
fix
Add overrides with parser: 'mdc' in Prettier config
Error: Invalid configuration file. Expected overrides to be an array.
Incorrect prettier config format (e.g., overrides as object instead of array)
fix
Use array: "overrides": [{ "files": ["*.md"], "options": { "parser": "mdc" } }]
error: unknown option `--parser'
Using CLI option --parser instead of config override
fix
Set parser in config file, not CLI. Run prettier --write without --parser
Upgrade
Version history
0.2.1latest on npm
Audit
Dependencies
prettierrequiredPeer dependency: requires Prettier version >=3.6.0 (as of v0.2.0)
Agent activity
25 hits · last 30 days
node
24
OpenAI (training)
1
Resources
prettier-plugin-mdc — npm install prettier-plugin-mdc · libregistry