GitHub - porada/prettier-plugin-markdown-html: Format raw HTML in Markdown with Prettier (original) (raw)
Format raw HTML in Markdown with Prettier.
Overview
This plugin adds an extra level of consistency to Markdown files by formatting raw HTML fragments.
- Works with
README.mdand any other GitHub-Flavored Markdown document. - Respects Prettier’s built-in HTML options.
- Comes without any additional dependencies.
Install
npm install --save-dev prettier-plugin-markdown-html
pnpm add --save-dev prettier-plugin-markdown-html
Usage
Reference prettier-plugin-markdown-html in your Prettier config:
{ "plugins": [ "prettier-plugin-markdown-html" ] }
Options
In addition to Prettier’s built-in options that affect HTML formatting, prettier-plugin-markdown-html offers additional configuration options.
interface PluginOptions {
/**
* Override the preferred line length for raw HTML fragments in Markdown.
* Unlike printWidth, this option does not affect code blocks or other
* Markdown content. Falls back to printWidth when unset.
* @default undefined
/
htmlFragmentPrintWidth?: number | undefined;
/*
* Enforce one HTML attribute per line for raw HTML fragments in Markdown.
* Unlike singleAttributePerLine, this option does not affect code blocks.
* Falls back to singleAttributePerLine when unset.
* @default undefined
/
htmlFragmentSingleAttributePerLine?: boolean | undefined;
/*
* Control whitespace handling for raw HTML fragments in Markdown. Unlike
* htmlWhitespaceSensitivity, this option does not affect code blocks.
* Falls back to htmlWhitespaceSensitivity when unset.
* @default undefined
*/
htmlFragmentWhitespaceSensitivity?: 'css' | 'strict' | 'ignore' | undefined;
}
Related
License
MIT © Dom Porada