A Prettier plugin that formats raw HTML fragments inside Markdown files (e.g., README.md), including those split by Markdown syntax. Version 1.4.0, stable, actively maintained. Released under MIT, ships TypeScript types. Key differentiators: respects Prettier's built-in HTML options, has no additional dependencies, and offers fragment-specific options like htmlFragmentPrintWidth and htmlFragmentSingleAttributePerLine that override global Prettier settings without affecting code blocks.
npm install prettier-plugin-markdown-htmlVerified import paths — ran on the pinned version, not inferred.
Minimal Prettier config enabling the plugin with custom fragment options, plus example input/output showing HTML formatting in Markdown.
Upgrade to ^1.0.0 or later.
Update Node.js to version 20 or higher.
Use these options only for fragment-specific tuning; consider using global printWidth for overall formatting.
Upgrade to >=1.2.0 to ensure the option works correctly.
Run `npm install --save-dev prettier-plugin-markdown-html` and ensure your Prettier config has it listed under 'plugins'.
Ensure Prettier is run in ESM mode (e.g., use `node --experimental-vm-modules` or configure Prettier to use ESM loader) or switch to a CJS-compatible version.
Upgrade Prettier to >=3.0.0 and ensure the plugin is listed once in the plugins array.