A configurable Prettier plugin for formatting embedded languages (SQL, XML, PHP, markdown, CSS, etc.) in JavaScript/TypeScript template literals. Version 0.5.1, active development with frequent releases. Unlike Prettier's built-in 'auto' mode, it allows per-language control, custom block comments/tags for language detection, and opt-out per tag. Ships TypeScript types. Supports additional languages beyond Prettier defaults, with options for indentation and formatting behavior.
npm install prettier-plugin-embedNo compatibility data collected yet for this library.
Verified import paths — ran on the pinned version, not inferred.
Shows basic setup: install plugin, add to Prettier config, enable formatting for SQL template literals tagged with 'sql'.
Remove any usage of throwIfPluginIsNotFound from your Prettier config.
Set embeddedLanguageFormatting: 'off' in Prettier config to avoid conflicts.
Ensure your template literals have a tag (e.g., sql`...`) or a block comment (/* sql */ `...`).
Remove the option from your Prettier config.
Review tag configuration; if using tags in options, they are now matched by identifier name as well as call expressions.
Install the required parser, e.g., npm i -D prettier-plugin-sql
Ensure Prettier version >= 2.3.0. Use 'embeddedLanguageFormatting' (not 'embeddedLanguageFormat').
Use 'import prettierPluginEmbed from 'prettier-plugin-embed'' and add to 'plugins' array as a member.