A Prettier plugin that correctly formats HTML with interpolated tag names (e.g., `<${Component}>`). Version 2.0.1 is current, stable, and requires Prettier 3+. Released sporadically, it solves the problem of Prettier breaking formatting when tag names are dynamic expressions. Unlike generic HTML formatting, this plugin preserves the interpolation syntax and avoids parsing errors. Ships TypeScript types and supports both ESM and CJS.
npm install prettier-plugin-interpolated-html-tagsVerified import paths — ran on the pinned version, not inferred.
Shows how to use the plugin to format HTML with interpolated tag names, preventing Prettier from breaking the template literal syntax.
Update Prettier to version 3 or later. If on Prettier v2, stay on v1.x of this plugin.
Upgrade to v1.0.0 or later for stable functionality.
Ensure you are using `parser: 'html'` in your Prettier config. For JSX, use separate plugins.
Upgrade to Prettier v3 and plugin v2 for best results.
Install the plugin via npm: `npm install --save-dev prettier-plugin-interpolated-html-tags`
Ensure you have `@prettier/plugin-html` installed or that Prettier's built-in parser is available. In Prettier v3, the HTML parser is bundled.
Either upgrade Prettier to v3, or downgrade the plugin to v1.x (e.g., `npm install prettier-plugin-interpolated-html-tags@1`).