prettier-plugin-embed 0.5.1 → 0.7.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +416 -393
- package/dist/embedded/astro/embedder.d.ts +7 -0
- package/dist/embedded/astro/index.d.ts +3 -0
- package/dist/embedded/astro/language.d.ts +6 -0
- package/dist/embedded/astro/options.d.ts +40 -0
- package/dist/embedded/create-embedder.d.ts +14 -0
- package/dist/embedded/css/embedder.d.ts +1 -6
- package/dist/embedded/dockerfile/embedder.d.ts +7 -0
- package/dist/embedded/dockerfile/index.d.ts +3 -0
- package/dist/embedded/dockerfile/language.d.ts +6 -0
- package/dist/embedded/dockerfile/options.d.ts +40 -0
- package/dist/embedded/es/embedder.d.ts +1 -6
- package/dist/embedded/es/options.d.ts +1 -1
- package/dist/embedded/gherkin/embedder.d.ts +7 -0
- package/dist/embedded/gherkin/index.d.ts +3 -0
- package/dist/embedded/gherkin/language.d.ts +6 -0
- package/dist/embedded/gherkin/options.d.ts +40 -0
- package/dist/embedded/glsl/embedder.d.ts +1 -6
- package/dist/embedded/go-template/embedder.d.ts +7 -0
- package/dist/embedded/go-template/index.d.ts +3 -0
- package/dist/embedded/go-template/language.d.ts +6 -0
- package/dist/embedded/go-template/options.d.ts +40 -0
- package/dist/embedded/graphql/embedder.d.ts +1 -6
- package/dist/embedded/handlebars/embedder.d.ts +7 -0
- package/dist/embedded/handlebars/index.d.ts +3 -0
- package/dist/embedded/handlebars/language.d.ts +6 -0
- package/dist/embedded/handlebars/options.d.ts +40 -0
- package/dist/embedded/html/embedder.d.ts +1 -6
- package/dist/embedded/html/options.d.ts +1 -1
- package/dist/embedded/hugo/embedder.d.ts +7 -0
- package/dist/embedded/hugo/index.d.ts +3 -0
- package/dist/embedded/hugo/language.d.ts +6 -0
- package/dist/embedded/hugo/options.d.ts +40 -0
- package/dist/embedded/ini/embedder.d.ts +1 -6
- package/dist/embedded/java/embedder.d.ts +1 -6
- package/dist/embedded/jinja/embedder.d.ts +7 -0
- package/dist/embedded/jinja/index.d.ts +3 -0
- package/dist/embedded/jinja/language.d.ts +6 -0
- package/dist/embedded/jinja/options.d.ts +40 -0
- package/dist/embedded/json/options.d.ts +1 -1
- package/dist/embedded/jsonata/embedder.d.ts +1 -6
- package/dist/embedded/jte/embedder.d.ts +7 -0
- package/dist/embedded/jte/index.d.ts +3 -0
- package/dist/embedded/jte/language.d.ts +6 -0
- package/dist/embedded/jte/options.d.ts +40 -0
- package/dist/embedded/latex/embedder.d.ts +1 -6
- package/dist/embedded/liquid/embedder.d.ts +7 -0
- package/dist/embedded/liquid/index.d.ts +3 -0
- package/dist/embedded/liquid/language.d.ts +6 -0
- package/dist/embedded/liquid/options.d.ts +40 -0
- package/dist/embedded/marko/embedder.d.ts +7 -0
- package/dist/embedded/marko/index.d.ts +3 -0
- package/dist/embedded/marko/language.d.ts +6 -0
- package/dist/embedded/marko/options.d.ts +40 -0
- package/dist/embedded/motoko/embedder.d.ts +7 -0
- package/dist/embedded/motoko/index.d.ts +3 -0
- package/dist/embedded/motoko/language.d.ts +6 -0
- package/dist/embedded/motoko/options.d.ts +40 -0
- package/dist/embedded/mustache/embedder.d.ts +7 -0
- package/dist/embedded/mustache/index.d.ts +3 -0
- package/dist/embedded/mustache/language.d.ts +6 -0
- package/dist/embedded/mustache/options.d.ts +40 -0
- package/dist/embedded/nginx/embedder.d.ts +1 -6
- package/dist/embedded/nunjucks/embedder.d.ts +7 -0
- package/dist/embedded/nunjucks/index.d.ts +3 -0
- package/dist/embedded/nunjucks/language.d.ts +6 -0
- package/dist/embedded/nunjucks/options.d.ts +40 -0
- package/dist/embedded/pegjs/embedder.d.ts +1 -6
- package/dist/embedded/php/embedder.d.ts +1 -6
- package/dist/embedded/powershell/embedder.d.ts +7 -0
- package/dist/embedded/powershell/index.d.ts +3 -0
- package/dist/embedded/powershell/language.d.ts +6 -0
- package/dist/embedded/powershell/options.d.ts +40 -0
- package/dist/embedded/prisma/embedder.d.ts +1 -6
- package/dist/embedded/properties/embedder.d.ts +1 -6
- package/dist/embedded/pug/embedder.d.ts +1 -6
- package/dist/embedded/register.d.ts +42 -25
- package/dist/embedded/ruby/embedder.d.ts +1 -6
- package/dist/embedded/ruby/options.d.ts +1 -1
- package/dist/embedded/sh/embedder.d.ts +1 -6
- package/dist/embedded/solidity/embedder.d.ts +7 -0
- package/dist/embedded/solidity/index.d.ts +3 -0
- package/dist/embedded/solidity/language.d.ts +6 -0
- package/dist/embedded/solidity/options.d.ts +58 -0
- package/dist/embedded/sql/options.d.ts +1 -1
- package/dist/embedded/svelte/embedder.d.ts +7 -0
- package/dist/embedded/svelte/index.d.ts +3 -0
- package/dist/embedded/svelte/language.d.ts +6 -0
- package/dist/embedded/svelte/options.d.ts +40 -0
- package/dist/embedded/toml/embedder.d.ts +1 -6
- package/dist/embedded/toml/plugin-toml-types.d.ts +2 -2
- package/dist/embedded/ts/embedder.d.ts +1 -6
- package/dist/embedded/ts/options.d.ts +1 -1
- package/dist/embedded/types.d.ts +1 -1
- package/dist/embedded/utils.d.ts +13 -4
- package/dist/embedded/xml/parser.d.ts +6 -4
- package/dist/embedded/xquery/embedder.d.ts +7 -0
- package/dist/embedded/xquery/index.d.ts +3 -0
- package/dist/embedded/xquery/language.d.ts +6 -0
- package/dist/embedded/xquery/options.d.ts +55 -0
- package/dist/import-module-worker.js +45 -0
- package/dist/index.js +2078 -3209
- package/dist/options.d.ts +341 -6
- package/dist/parsers.d.ts +6 -6
- package/dist/type-utils.d.ts +5 -0
- package/dist/types.d.ts +1 -1
- package/dist/utils.d.ts +3 -3
- package/package.json +55 -47
package/README.md
CHANGED
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
A configurable [Prettier](https://prettier.io/) [plugin](https://prettier.io/docs/en/plugins.html) to format [embedded languages](https://prettier.io/docs/en/options.html#embedded-language-formatting) in JS/TS Files.
|
|
12
12
|
|
|
13
13
|
```bash
|
|
14
|
-
npm i -D prettier-plugin-embed
|
|
14
|
+
npm i -D prettier prettier-plugin-embed
|
|
15
15
|
```
|
|
16
16
|
|
|
17
17
|
</div>
|
|
@@ -20,19 +20,19 @@ npm i -D prettier-plugin-embed
|
|
|
20
20
|
|
|
21
21
|
### What?
|
|
22
22
|
|
|
23
|
-
This Prettier plugin
|
|
23
|
+
This Prettier plugin formats [embedded languages](https://prettier.io/docs/options#embedded-language-formatting) in [template literals](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Template_literals) within JavaScript and TypeScript files.
|
|
24
24
|
|
|
25
25
|
### Why?
|
|
26
26
|
|
|
27
|
-
|
|
27
|
+
It adds per-language formatting controls, configurable block comments and tags, and per-identifier overrides to Prettier's embedded formatting. See [prettier/prettier#4424](https://github.com/prettier/prettier/issues/4424) and [prettier/prettier#5588](https://github.com/prettier/prettier/issues/5588) for related use cases.
|
|
28
28
|
|
|
29
29
|
### How?
|
|
30
30
|
|
|
31
|
-
|
|
31
|
+
The plugin extends the [`embed`](https://prettier.io/docs/plugins#embed) method of Prettier's `estree` printer. Each integration delegates formatting to Prettier or a loaded language plugin. See [the printer implementation](./src/printers.ts) for the integration point.
|
|
32
32
|
|
|
33
33
|
## Features
|
|
34
34
|
|
|
35
|
-
- **Support for Additional Languages:** Extend
|
|
35
|
+
- **Support for Additional Languages:** Extend embedded formatting to languages such as XML, SQL, PHP, and more. See [Language-Specific Options](#language-specific-options) for the supported languages and their default identifiers.
|
|
36
36
|
|
|
37
37
|
- **Dual Identification Modes:** Identify embedded languages by block comments `` /* comment */ `...` `` or tags `` tag`...` `` preceding the template literals.
|
|
38
38
|
|
|
@@ -49,9 +49,33 @@ By leveraging Prettier's plugin system, this plugin overrides the default [`embe
|
|
|
49
49
|
## Installation
|
|
50
50
|
|
|
51
51
|
```bash
|
|
52
|
-
npm i -D prettier-plugin-embed
|
|
52
|
+
npm i -D prettier prettier-plugin-embed
|
|
53
53
|
```
|
|
54
54
|
|
|
55
|
+
Install Prettier 3 in the project that runs formatting. The consumer supplies the formatter and its language plugins.
|
|
56
|
+
|
|
57
|
+
Install the formatter plugin for each embedded language you use as a separate project dependency; the [Language-Specific Options](#language-specific-options) section shows which integrations require one.
|
|
58
|
+
|
|
59
|
+
Choose Prettier and runtime versions supported by every loaded language plugin. Parser availability and syntax support follow the installed formatter version.
|
|
60
|
+
|
|
61
|
+
<details>
|
|
62
|
+
<summary>Dependency resolution in strict installations</summary>
|
|
63
|
+
|
|
64
|
+
The plugin loads Prettier through static imports, which resolve from the plugin's installation location. Standard project installs and Yarn's default Plug'n'Play dependency fallback allow these imports to access the project's installed Prettier.
|
|
65
|
+
|
|
66
|
+
Yarn projects using `pnpFallbackMode: none`, and pnpm projects using `enableGlobalVirtualStore: true` with hoisting disabled, need an explicit dependency relationship for this resolution. For these configurations, add the following to `.yarnrc.yml` (Yarn) or `pnpm-workspace.yaml` (pnpm) to connect the plugin to the project's installed Prettier:
|
|
67
|
+
|
|
68
|
+
```yaml
|
|
69
|
+
packageExtensions:
|
|
70
|
+
"prettier-plugin-embed@*":
|
|
71
|
+
peerDependencies:
|
|
72
|
+
prettier: ">=3.0.0 <4"
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
Projects can also use Yarn's default `pnpFallbackMode: dependencies-only` or pnpm's project-local virtual store (`enableGlobalVirtualStore: false`).
|
|
76
|
+
|
|
77
|
+
</details>
|
|
78
|
+
|
|
55
79
|
## Usage
|
|
56
80
|
|
|
57
81
|
### Getting Started
|
|
@@ -85,54 +109,92 @@ await prettier.format(code, {
|
|
|
85
109
|
}
|
|
86
110
|
```
|
|
87
111
|
|
|
112
|
+
For Yarn Plug'n'Play, load plugin objects from a JavaScript config so the imports resolve through Yarn's dependency map.
|
|
113
|
+
|
|
114
|
+
```js
|
|
115
|
+
import * as prettierPluginEmbed from "prettier-plugin-embed";
|
|
116
|
+
|
|
117
|
+
export default {
|
|
118
|
+
plugins: [prettierPluginEmbed],
|
|
119
|
+
};
|
|
120
|
+
```
|
|
121
|
+
|
|
88
122
|
### Quick Start Config Examples
|
|
89
123
|
|
|
90
|
-
|
|
124
|
+
See [Config Examples](./ConfigExamples.md) for complete language plugin configurations and sample output.
|
|
91
125
|
|
|
92
126
|
### An Overview of the Philosophy
|
|
93
127
|
|
|
94
|
-
|
|
128
|
+
Set [`embeddedLanguageFormatting`](https://prettier.io/docs/options#embedded-language-formatting) to `"auto"` (Prettier's default) to enable embedded formatting.
|
|
129
|
+
|
|
130
|
+
This plugin uses Prettier's built-in parsers and existing [language plugins](https://prettier.io/docs/plugins#official-plugins), adding the integration needed to format their languages inside template literals.
|
|
131
|
+
|
|
132
|
+
Install and load the formatter plugin for each additional language you use. For example, embedded XML requires both this plugin and [`@prettier/plugin-xml`](https://github.com/prettier/plugin-xml#readme). The [Language-Specific Options](#language-specific-options) section lists the required plugins.
|
|
133
|
+
|
|
134
|
+
A preceding [block comment](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Lexical_grammar#block_comments) such as `` /* xml */ `...` `` or a [tag](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Template_literals#tagged_templates) such as `` xml`...` `` identifies the embedded language. Configure each language with `embedded<Language>Comments` and `embedded<Language>Tags`. A leading block comment is checked first; templates without one are matched by their tag.
|
|
95
135
|
|
|
96
|
-
|
|
136
|
+
Tags support exact identifiers, member expressions, and regular expression strings in `/pattern/flags` form. Simple identifiers support patterns too: `"/^query$/"` matches the tag `query`. Member and call expressions use a normalized form for pattern matching; for example, `factory(argument).query` becomes `factory().query`.
|
|
97
137
|
|
|
98
|
-
|
|
138
|
+
For example, this JSON configuration matches `prisma.$queryRaw`, `client.$queryRaw`, and `ctx.prisma.$queryRaw`. JSON and JavaScript strings escape each backslash as `\\`:
|
|
99
139
|
|
|
100
|
-
|
|
140
|
+
```json
|
|
141
|
+
{
|
|
142
|
+
"plugins": ["prettier-plugin-embed", "prettier-plugin-sql"],
|
|
143
|
+
"embeddedSqlTags": ["/\\.\\$queryRaw$/"]
|
|
144
|
+
}
|
|
145
|
+
```
|
|
101
146
|
|
|
102
|
-
|
|
147
|
+
Add comments or tags to `embeddedNoopComments` or `embeddedNoopTags` to preserve their template content as written. These options take priority among matching languages. Other overlapping matches use the first matching language in the internal registry; assign distinct identifiers or non-overlapping patterns to select a language explicitly.
|
|
103
148
|
|
|
104
149
|
> [!IMPORTANT]
|
|
105
150
|
>
|
|
106
|
-
>
|
|
151
|
+
> Specify comments or tags explicitly to keep language identification stable across plugin versions.
|
|
107
152
|
|
|
108
153
|
### Language-Specific Options
|
|
109
154
|
|
|
110
|
-
Supported embedded languages are:
|
|
111
|
-
|
|
112
|
-
- [
|
|
113
|
-
- [
|
|
114
|
-
- [
|
|
115
|
-
- [
|
|
116
|
-
- [
|
|
117
|
-
- [
|
|
118
|
-
- [
|
|
119
|
-
- [
|
|
120
|
-
- [
|
|
121
|
-
- [
|
|
122
|
-
- [
|
|
123
|
-
- [
|
|
124
|
-
- [
|
|
125
|
-
- [
|
|
126
|
-
- [
|
|
127
|
-
- [
|
|
128
|
-
- [
|
|
129
|
-
- [
|
|
130
|
-
- [
|
|
131
|
-
- [
|
|
132
|
-
- [
|
|
133
|
-
- [
|
|
134
|
-
- [
|
|
135
|
-
- [
|
|
155
|
+
Supported embedded languages and their default comment/tag identifiers are:
|
|
156
|
+
|
|
157
|
+
- [Astro](#astro): `astro`
|
|
158
|
+
- [CSS](#css): `css`
|
|
159
|
+
- [Dockerfile](#dockerfile): `dockerfile`, `containerfile`
|
|
160
|
+
- [ES (ECMAScript/JavaScript)](#es-ecmascriptjavascript): `js`, `jsx`, `es`, `es6`, `mjs`, `cjs`, `pac`, `javascript`
|
|
161
|
+
- [Gherkin](#gherkin): `gherkin`, `feature`
|
|
162
|
+
- [GLSL](#glsl): `glsl`, `shader`
|
|
163
|
+
- [Go Template](#go-template): `goTemplate`, `gotmpl`
|
|
164
|
+
- [GraphQL](#graphql): `graphql`, `gql`
|
|
165
|
+
- [Handlebars](#handlebars): `handlebars`, `hbs`
|
|
166
|
+
- [HTML](#html): `html`, `xhtml`
|
|
167
|
+
- [Hugo](#hugo): `hugo`, `hugoPost`
|
|
168
|
+
- [INI](#ini): `ini`, `cfg`, `pro`
|
|
169
|
+
- [Java](#java): `java`
|
|
170
|
+
- [Jinja](#jinja): `jinja`, `jinja2`, `j2`
|
|
171
|
+
- [JSON](#json): `json`, `jsonl`
|
|
172
|
+
- [JSONata](#jsonata): `jsonata`
|
|
173
|
+
- [JTE](#jte): `jte`
|
|
174
|
+
- [LaTeX](#latex): `latex`, `tex`, `aux`, `cls`, `bbl`, `bib`, `toc`, `sty`
|
|
175
|
+
- [Liquid](#liquid): `liquid`
|
|
176
|
+
- [Markdown](#markdown): `md`, `markdown`
|
|
177
|
+
- [Marko](#marko): `marko`
|
|
178
|
+
- [Motoko](#motoko): `motoko`, `mo`
|
|
179
|
+
- [Mustache](#mustache): `mustache`
|
|
180
|
+
- [NGINX](#nginx): `nginx`
|
|
181
|
+
- [Nunjucks](#nunjucks): `nunjucks`, `njk`
|
|
182
|
+
- [Pegjs](#pegjs): `pegjs`, `peggy`, `peg`
|
|
183
|
+
- [PHP](#php): `php`, `php5`
|
|
184
|
+
- [PowerShell](#powershell): `powershell`, `ps1`
|
|
185
|
+
- [Prisma](#prisma): `prisma`
|
|
186
|
+
- [Properties](#properties): `properties`
|
|
187
|
+
- [Pug](#pug): `pug`, `jade`
|
|
188
|
+
- [Ruby](#ruby): `ruby`
|
|
189
|
+
- [Sh (Shell)](#sh-shell): `sh`
|
|
190
|
+
- [Solidity](#solidity): `solidity`, `sol`
|
|
191
|
+
- [SQL](#sql): `sql`
|
|
192
|
+
- [Svelte](#svelte): `svelte`
|
|
193
|
+
- [TOML](#toml): `toml`
|
|
194
|
+
- [TS (TypeScript)](#ts-typescript): `ts`, `tsx`, `cts`, `mts`, `typescript`
|
|
195
|
+
- [XML](#xml): `xml`, `opml`, `rss`, `svg`
|
|
196
|
+
- [XQuery](#xquery): `xquery`, `xq`
|
|
197
|
+
- [YAML](#yaml): `yaml`, `yml`
|
|
136
198
|
|
|
137
199
|
<details open>
|
|
138
200
|
<summary>
|
|
@@ -153,20 +215,23 @@ Click Here to Toggle
|
|
|
153
215
|
- **Default**: [`[]`](./src/embedded/noop/options.ts)
|
|
154
216
|
- **Description**: Tags that prevent their subsequent template literals from being identified as embedded languages and thus from being formatted.
|
|
155
217
|
|
|
156
|
-
|
|
218
|
+
This built-in option can override native embedded language formatting for the specified comments or tags, preserving their template literal content as written.
|
|
157
219
|
|
|
158
|
-
|
|
159
|
-
|
|
220
|
+
#### Astro
|
|
221
|
+
|
|
222
|
+
##### `embeddedAstroComments`
|
|
160
223
|
|
|
161
224
|
- **Type**: `string[]`
|
|
162
|
-
- **Default**: [`[]`](./src/embedded/
|
|
163
|
-
- **Description**:
|
|
225
|
+
- **Default**: [`["astro"]`](./src/embedded/astro/options.ts)
|
|
226
|
+
- **Description**: Block comments that identify embedded Astro in template literals. Requires the [`prettier-plugin-astro`](https://github.com/withastro/prettier-plugin-astro#readme) plugin.
|
|
164
227
|
|
|
165
|
-
|
|
228
|
+
##### `embeddedAstroTags`
|
|
166
229
|
|
|
167
|
-
|
|
230
|
+
- **Type**: `string[]`
|
|
231
|
+
- **Default**: [`["astro"]`](./src/embedded/astro/options.ts)
|
|
232
|
+
- **Description**: Tags that identify embedded Astro in template literals. Requires the [`prettier-plugin-astro`](https://github.com/withastro/prettier-plugin-astro#readme) plugin.
|
|
168
233
|
|
|
169
|
-
|
|
234
|
+
Formatting embedded Astro requires the [`prettier-plugin-astro`](https://github.com/withastro/prettier-plugin-astro#readme) plugin to be installed and loaded. Its options control the embedded formatting behavior.
|
|
170
235
|
|
|
171
236
|
#### CSS
|
|
172
237
|
|
|
@@ -182,57 +247,49 @@ This "language" doesn't require other plugins and can override the native embedd
|
|
|
182
247
|
- **Default**: [`["css"]`](./src/embedded/css/options.ts)
|
|
183
248
|
- **Description**: Tags that make their subsequent template literals be identified as embedded CSS language.
|
|
184
249
|
|
|
185
|
-
##### ~~`embeddedCssIdentifiers`~~
|
|
186
|
-
|
|
187
|
-
<details>
|
|
188
|
-
<summary>deprecated</summary>
|
|
189
|
-
|
|
190
|
-
- **Type**: `string[]`
|
|
191
|
-
- **Default**: [`["css"]`](./src/embedded/css/options.ts)
|
|
192
|
-
- **Description**: Comment or tag identifiers that make their subsequent template literals be identified as embedded CSS language.
|
|
193
|
-
|
|
194
|
-
Please use `embeddedCssComments` or `embeddedCssTags`.
|
|
195
|
-
|
|
196
|
-
</details>
|
|
197
|
-
|
|
198
250
|
##### `embeddedCssParser`
|
|
199
251
|
|
|
200
252
|
- **Type**: [`"css" | "less" | "scss"`](./src/embedded/css/options.ts)
|
|
201
253
|
- **Default**: [`"scss"`](./src/embedded/css/options.ts)
|
|
202
254
|
- **Description**: The parser used to parse the embedded CSS language.
|
|
203
255
|
|
|
204
|
-
|
|
256
|
+
Embedded CSS uses the parsers and printers included with Prettier.
|
|
205
257
|
|
|
206
|
-
This can override the native formatting
|
|
258
|
+
This can override the native formatting behavior for embedded CSS language. If you want to keep the native behavior, set `embeddedCssComments` or `embeddedCssTags` to `[]` or other values.
|
|
207
259
|
|
|
208
260
|
If you want to specify different parsers for different comments or tags, check [`embeddedOverrides`](#embeddedoverrides-1).
|
|
209
261
|
|
|
210
|
-
####
|
|
262
|
+
#### Dockerfile
|
|
211
263
|
|
|
212
|
-
##### `
|
|
264
|
+
##### `embeddedDockerfileComments`
|
|
213
265
|
|
|
214
266
|
- **Type**: `string[]`
|
|
215
|
-
- **Default**: [`["
|
|
216
|
-
- **Description**: Block comments that
|
|
267
|
+
- **Default**: [`["dockerfile", "containerfile"]`](./src/embedded/dockerfile/options.ts)
|
|
268
|
+
- **Description**: Block comments that identify embedded Dockerfile in template literals. Requires the [`prettier-plugin-sh`](https://github.com/un-ts/prettier/tree/master/packages/sh#readme) plugin.
|
|
217
269
|
|
|
218
|
-
##### `
|
|
270
|
+
##### `embeddedDockerfileTags`
|
|
219
271
|
|
|
220
272
|
- **Type**: `string[]`
|
|
221
|
-
- **Default**: [`["
|
|
222
|
-
- **Description**: Tags that
|
|
273
|
+
- **Default**: [`["dockerfile", "containerfile"]`](./src/embedded/dockerfile/options.ts)
|
|
274
|
+
- **Description**: Tags that identify embedded Dockerfile in template literals. Requires the [`prettier-plugin-sh`](https://github.com/un-ts/prettier/tree/master/packages/sh#readme) plugin.
|
|
223
275
|
|
|
224
|
-
|
|
276
|
+
Formatting embedded Dockerfile requires the [`prettier-plugin-sh`](https://github.com/un-ts/prettier/tree/master/packages/sh#readme) plugin to be installed and loaded. Its options control the embedded formatting behavior.
|
|
225
277
|
|
|
226
|
-
|
|
227
|
-
|
|
278
|
+
Dockerfile and Shell share `prettier-plugin-sh`; the Dockerfile integration selects its `dockerfile` parser.
|
|
279
|
+
|
|
280
|
+
#### ES (ECMAScript/JavaScript)
|
|
281
|
+
|
|
282
|
+
##### `embeddedEsComments`
|
|
228
283
|
|
|
229
284
|
- **Type**: `string[]`
|
|
230
285
|
- **Default**: [`["js", "jsx", "es", "es6", "mjs", "cjs", "pac", "javascript"]`](./src/embedded/es/options.ts)
|
|
231
|
-
- **Description**:
|
|
286
|
+
- **Description**: Block comments that make their subsequent template literals be identified as embedded ECMAScript/JavaScript language.
|
|
232
287
|
|
|
233
|
-
|
|
288
|
+
##### `embeddedEsTags`
|
|
234
289
|
|
|
235
|
-
|
|
290
|
+
- **Type**: `string[]`
|
|
291
|
+
- **Default**: [`["js", "jsx", "es", "es6", "mjs", "cjs", "pac", "javascript"]`](./src/embedded/es/options.ts)
|
|
292
|
+
- **Description**: Tags that make their subsequent template literals be identified as embedded ECMAScript/JavaScript language.
|
|
236
293
|
|
|
237
294
|
##### `embeddedEsParser`
|
|
238
295
|
|
|
@@ -240,38 +297,57 @@ Please use `embeddedEsComments` or `embeddedEsTags`.
|
|
|
240
297
|
- **Default**: [`"babel"`](./src/embedded/es/options.ts)
|
|
241
298
|
- **Description**: The parser used to parse the embedded ECMASCript/JavaScript language.
|
|
242
299
|
|
|
243
|
-
|
|
300
|
+
Embedded ECMAScript and JavaScript use the parsers and printers included with Prettier.
|
|
244
301
|
|
|
245
302
|
If you want to specify different parsers for different comments or tags, check [`embeddedOverrides`](#embeddedoverrides-1).
|
|
246
303
|
|
|
304
|
+
#### Gherkin
|
|
305
|
+
|
|
306
|
+
##### `embeddedGherkinComments`
|
|
307
|
+
|
|
308
|
+
- **Type**: `string[]`
|
|
309
|
+
- **Default**: [`["gherkin", "feature"]`](./src/embedded/gherkin/options.ts)
|
|
310
|
+
- **Description**: Block comments that identify embedded Gherkin in template literals. Requires the [`prettier-plugin-gherkin`](https://github.com/mapado/prettier-plugin-gherkin#readme) plugin.
|
|
311
|
+
|
|
312
|
+
##### `embeddedGherkinTags`
|
|
313
|
+
|
|
314
|
+
- **Type**: `string[]`
|
|
315
|
+
- **Default**: [`["gherkin", "feature"]`](./src/embedded/gherkin/options.ts)
|
|
316
|
+
- **Description**: Tags that identify embedded Gherkin in template literals. Requires the [`prettier-plugin-gherkin`](https://github.com/mapado/prettier-plugin-gherkin#readme) plugin.
|
|
317
|
+
|
|
318
|
+
Formatting embedded Gherkin requires the [`prettier-plugin-gherkin`](https://github.com/mapado/prettier-plugin-gherkin#readme) plugin to be installed and loaded. Its options control the embedded formatting behavior.
|
|
319
|
+
|
|
247
320
|
#### GLSL
|
|
248
321
|
|
|
249
322
|
##### `embeddedGlslComments`
|
|
250
323
|
|
|
251
324
|
- **Type**: `string[]`
|
|
252
325
|
- **Default**: [`["glsl", "shader"]`](./src/embedded/glsl/options.ts)
|
|
253
|
-
- **Description**: Block comments that make their subsequent template literals be identified as embedded GLSL language. This option requires the `prettier-plugin-glsl` plugin.
|
|
326
|
+
- **Description**: Block comments that make their subsequent template literals be identified as embedded GLSL language. This option requires the [`prettier-plugin-glsl`](https://github.com/NaridaL/glsl-language-toolkit/tree/main/packages/prettier-plugin-glsl#readme) plugin.
|
|
254
327
|
|
|
255
328
|
##### `embeddedGlslTags`
|
|
256
329
|
|
|
257
330
|
- **Type**: `string[]`
|
|
258
331
|
- **Default**: [`["glsl", "shader"]`](./src/embedded/glsl/options.ts)
|
|
259
|
-
- **Description**: Tags that make their subsequent template literals be identified as embedded GLSL language. This option requires the `prettier-plugin-glsl` plugin.
|
|
332
|
+
- **Description**: Tags that make their subsequent template literals be identified as embedded GLSL language. This option requires the [`prettier-plugin-glsl`](https://github.com/NaridaL/glsl-language-toolkit/tree/main/packages/prettier-plugin-glsl#readme) plugin.
|
|
260
333
|
|
|
261
|
-
|
|
334
|
+
Formatting embedded GLSL language requires the [`prettier-plugin-glsl`](https://github.com/NaridaL/glsl-language-toolkit/tree/main/packages/prettier-plugin-glsl#readme) plugin to be loaded as well.
|
|
262
335
|
|
|
263
|
-
|
|
264
|
-
|
|
336
|
+
#### Go Template
|
|
337
|
+
|
|
338
|
+
##### `embeddedGoTemplateComments`
|
|
265
339
|
|
|
266
340
|
- **Type**: `string[]`
|
|
267
|
-
- **Default**: [`["
|
|
268
|
-
- **Description**:
|
|
341
|
+
- **Default**: [`["goTemplate", "gotmpl"]`](./src/embedded/go-template/options.ts)
|
|
342
|
+
- **Description**: Block comments that identify embedded Go Template in template literals. Requires the [`@htnabe/prettier-plugin-go-template`](https://github.com/htnabe/prettier-plugin-go-template#readme) plugin.
|
|
269
343
|
|
|
270
|
-
|
|
344
|
+
##### `embeddedGoTemplateTags`
|
|
271
345
|
|
|
272
|
-
|
|
346
|
+
- **Type**: `string[]`
|
|
347
|
+
- **Default**: [`["goTemplate", "gotmpl"]`](./src/embedded/go-template/options.ts)
|
|
348
|
+
- **Description**: Tags that identify embedded Go Template in template literals. Requires the [`@htnabe/prettier-plugin-go-template`](https://github.com/htnabe/prettier-plugin-go-template#readme) plugin.
|
|
273
349
|
|
|
274
|
-
Formatting embedded
|
|
350
|
+
Formatting embedded Go Template requires the [`@htnabe/prettier-plugin-go-template`](https://github.com/htnabe/prettier-plugin-go-template#readme) plugin to be installed and loaded. Its options control the embedded formatting behavior.
|
|
275
351
|
|
|
276
352
|
#### GraphQL
|
|
277
353
|
|
|
@@ -287,22 +363,25 @@ Formatting embedded GLSL language requires the [`prettier-plugin-glsl`](https://
|
|
|
287
363
|
- **Default**: [`["graphql", "gql"]`](./src/embedded/graphql/options.ts)
|
|
288
364
|
- **Description**: Tags that make their subsequent template literals be identified as embedded GraphQL language.
|
|
289
365
|
|
|
290
|
-
|
|
366
|
+
Embedded GraphQL uses the parsers and printers included with Prettier.
|
|
291
367
|
|
|
292
|
-
|
|
293
|
-
<summary>deprecated</summary>
|
|
368
|
+
This can override the native formatting behavior for embedded GraphQL language. If you want to keep the native behavior, set `embeddedGraphqlComments` or `embeddedGraphqlTags` to `[]` or other values.
|
|
294
369
|
|
|
295
|
-
|
|
296
|
-
- **Default**: [`["graphql", "gql"]`](./src/embedded/graphql/options.ts)
|
|
297
|
-
- **Description**: Comment or tag identifiers that make their subsequent template literals be identified as embedded GraphQL language.
|
|
370
|
+
#### Handlebars
|
|
298
371
|
|
|
299
|
-
|
|
372
|
+
##### `embeddedHandlebarsComments`
|
|
300
373
|
|
|
301
|
-
|
|
374
|
+
- **Type**: `string[]`
|
|
375
|
+
- **Default**: [`["handlebars", "hbs"]`](./src/embedded/handlebars/options.ts)
|
|
376
|
+
- **Description**: Block comments that identify embedded Handlebars in template literals. Requires the [`@poliklot/prettier-plugin-handlebars`](https://github.com/Poliklot/prettier-plugin-handlebars#readme) plugin.
|
|
302
377
|
|
|
303
|
-
|
|
378
|
+
##### `embeddedHandlebarsTags`
|
|
304
379
|
|
|
305
|
-
|
|
380
|
+
- **Type**: `string[]`
|
|
381
|
+
- **Default**: [`["handlebars", "hbs"]`](./src/embedded/handlebars/options.ts)
|
|
382
|
+
- **Description**: Tags that identify embedded Handlebars in template literals. Requires the [`@poliklot/prettier-plugin-handlebars`](https://github.com/Poliklot/prettier-plugin-handlebars#readme) plugin.
|
|
383
|
+
|
|
384
|
+
Formatting embedded Handlebars requires the [`@poliklot/prettier-plugin-handlebars`](https://github.com/Poliklot/prettier-plugin-handlebars#readme) plugin to be installed and loaded. Its options control the embedded formatting behavior.
|
|
306
385
|
|
|
307
386
|
#### HTML
|
|
308
387
|
|
|
@@ -318,59 +397,49 @@ This can override the native formatting behavior for embedded GraphQL language.
|
|
|
318
397
|
- **Default**: [`["html", "xhtml"]`](./src/embedded/html/options.ts)
|
|
319
398
|
- **Description**: Tags that make their subsequent template literals be identified as embedded HTML language.
|
|
320
399
|
|
|
321
|
-
##### ~~`embeddedHtmlIdentifiers`~~
|
|
322
|
-
|
|
323
|
-
<details>
|
|
324
|
-
<summary>deprecated</summary>
|
|
325
|
-
|
|
326
|
-
- **Type**: `string[]`
|
|
327
|
-
- **Default**: [`["html", "xhtml"]`](./src/embedded/html/options.ts)
|
|
328
|
-
- **Description**: Comment or tag identifiers that make their subsequent template literals be identified as embedded HTML language.
|
|
329
|
-
|
|
330
|
-
Please use `embeddedHtmlComments` or `embeddedHtmlTags`.
|
|
331
|
-
|
|
332
|
-
</details>
|
|
333
|
-
|
|
334
400
|
##### `embeddedHtmlParser`
|
|
335
401
|
|
|
336
402
|
- **Type**: [`"html" | "vue" | "angular" | "lwc"`](./src/embedded/html/options.ts)
|
|
337
403
|
- **Default**: [`"html"`](./src/embedded/html/options.ts)
|
|
338
404
|
- **Description**: The parser used to parse the embedded HTML language.
|
|
339
405
|
|
|
340
|
-
|
|
406
|
+
Embedded HTML uses the parsers and printers included with Prettier.
|
|
341
407
|
|
|
342
408
|
This can override the native formatting behavior for embedded HTML language. If you want to keep the native behavior, set `embeddedHtmlComments` or `embeddedHtmlTags` to `[]` or other values.
|
|
343
409
|
|
|
344
410
|
If you want to specify different parsers for different comments or tags, check [`embeddedOverrides`](#embeddedoverrides-1).
|
|
345
411
|
|
|
346
|
-
####
|
|
412
|
+
#### Hugo
|
|
347
413
|
|
|
348
|
-
##### `
|
|
414
|
+
##### `embeddedHugoComments`
|
|
349
415
|
|
|
350
416
|
- **Type**: `string[]`
|
|
351
|
-
- **Default**: [`["
|
|
352
|
-
- **Description**: Block comments that
|
|
417
|
+
- **Default**: [`["hugo", "hugoPost"]`](./src/embedded/hugo/options.ts)
|
|
418
|
+
- **Description**: Block comments that identify embedded Hugo in template literals. Requires the [`@htnabe/prettier-plugin-hugo-post`](https://github.com/htnabe/prettier-plugin-hugo-post#readme) plugin.
|
|
353
419
|
|
|
354
|
-
##### `
|
|
420
|
+
##### `embeddedHugoTags`
|
|
355
421
|
|
|
356
422
|
- **Type**: `string[]`
|
|
357
|
-
- **Default**: [`["
|
|
358
|
-
- **Description**: Tags that
|
|
423
|
+
- **Default**: [`["hugo", "hugoPost"]`](./src/embedded/hugo/options.ts)
|
|
424
|
+
- **Description**: Tags that identify embedded Hugo in template literals. Requires the [`@htnabe/prettier-plugin-hugo-post`](https://github.com/htnabe/prettier-plugin-hugo-post#readme) plugin.
|
|
359
425
|
|
|
360
|
-
|
|
426
|
+
Formatting embedded Hugo requires the [`@htnabe/prettier-plugin-hugo-post`](https://github.com/htnabe/prettier-plugin-hugo-post#readme) plugin to be installed and loaded. Its options control the embedded formatting behavior.
|
|
361
427
|
|
|
362
|
-
|
|
363
|
-
|
|
428
|
+
#### INI
|
|
429
|
+
|
|
430
|
+
##### `embeddedIniComments`
|
|
364
431
|
|
|
365
432
|
- **Type**: `string[]`
|
|
366
433
|
- **Default**: [`["ini", "cfg", "pro"]`](./src/embedded/ini/options.ts)
|
|
367
|
-
- **Description**:
|
|
434
|
+
- **Description**: Block comments that make their subsequent template literals be identified as embedded INI language. This option requires the [`prettier-plugin-ini`](https://github.com/kddnewton/prettier-plugin-ini#readme) plugin.
|
|
368
435
|
|
|
369
|
-
|
|
436
|
+
##### `embeddedIniTags`
|
|
370
437
|
|
|
371
|
-
|
|
438
|
+
- **Type**: `string[]`
|
|
439
|
+
- **Default**: [`["ini", "cfg", "pro"]`](./src/embedded/ini/options.ts)
|
|
440
|
+
- **Description**: Tags that make their subsequent template literals be identified as embedded INI language. This option requires the [`prettier-plugin-ini`](https://github.com/kddnewton/prettier-plugin-ini#readme) plugin.
|
|
372
441
|
|
|
373
|
-
Formatting embedded INI language requires the [`prettier-plugin-ini`](https://github.com/kddnewton/prettier-plugin-ini) plugin to be loaded as well. And [options](https://github.com/kddnewton/prettier-plugin-ini#configuration) supported by `prettier-plugin-ini` can therefore be used to further control the formatting behavior.
|
|
442
|
+
Formatting embedded INI language requires the [`prettier-plugin-ini`](https://github.com/kddnewton/prettier-plugin-ini#readme) plugin to be loaded as well. And [options](https://github.com/kddnewton/prettier-plugin-ini#configuration) supported by `prettier-plugin-ini` can therefore be used to further control the formatting behavior.
|
|
374
443
|
|
|
375
444
|
#### Java
|
|
376
445
|
|
|
@@ -378,28 +447,33 @@ Formatting embedded INI language requires the [`prettier-plugin-ini`](https://gi
|
|
|
378
447
|
|
|
379
448
|
- **Type**: `string[]`
|
|
380
449
|
- **Default**: [`["java"]`](./src/embedded/java/options.ts)
|
|
381
|
-
- **Description**: Block comments that make their subsequent template literals be identified as embedded Java language. This option requires the `prettier-plugin-java` plugin.
|
|
450
|
+
- **Description**: Block comments that make their subsequent template literals be identified as embedded Java language. This option requires the [`prettier-plugin-java`](https://github.com/jhipster/prettier-java#readme) plugin.
|
|
382
451
|
|
|
383
452
|
##### `embeddedJavaTags`
|
|
384
453
|
|
|
385
454
|
- **Type**: `string[]`
|
|
386
455
|
- **Default**: [`["java"]`](./src/embedded/java/options.ts)
|
|
387
|
-
- **Description**: Tags that make their subsequent template literals be identified as embedded Java language. This option requires the `prettier-plugin-java` plugin.
|
|
456
|
+
- **Description**: Tags that make their subsequent template literals be identified as embedded Java language. This option requires the [`prettier-plugin-java`](https://github.com/jhipster/prettier-java#readme) plugin.
|
|
388
457
|
|
|
389
|
-
|
|
458
|
+
Formatting embedded Java language requires the [`prettier-plugin-java`](https://github.com/jhipster/prettier-java#readme) plugin to be loaded as well. And [options](https://github.com/jhipster/prettier-java/blob/main/docs/advanced_usage.md#configuration) supported by `prettier-plugin-java` can therefore be used to further control the formatting behavior.
|
|
390
459
|
|
|
391
|
-
|
|
392
|
-
|
|
460
|
+
#### Jinja
|
|
461
|
+
|
|
462
|
+
##### `embeddedJinjaComments`
|
|
393
463
|
|
|
394
464
|
- **Type**: `string[]`
|
|
395
|
-
- **Default**: [`["
|
|
396
|
-
- **Description**:
|
|
465
|
+
- **Default**: [`["jinja", "jinja2", "j2"]`](./src/embedded/jinja/options.ts)
|
|
466
|
+
- **Description**: Block comments that identify embedded Jinja in template literals. Requires the [`prettier-plugin-jinja-template`](https://github.com/davidodenwald/prettier-plugin-jinja-template#readme) plugin.
|
|
397
467
|
|
|
398
|
-
|
|
468
|
+
##### `embeddedJinjaTags`
|
|
399
469
|
|
|
400
|
-
|
|
470
|
+
- **Type**: `string[]`
|
|
471
|
+
- **Default**: [`["jinja", "jinja2", "j2"]`](./src/embedded/jinja/options.ts)
|
|
472
|
+
- **Description**: Tags that identify embedded Jinja in template literals. Requires the [`prettier-plugin-jinja-template`](https://github.com/davidodenwald/prettier-plugin-jinja-template#readme) plugin.
|
|
401
473
|
|
|
402
|
-
Formatting embedded
|
|
474
|
+
Formatting embedded Jinja requires the [`prettier-plugin-jinja-template`](https://github.com/davidodenwald/prettier-plugin-jinja-template#readme) plugin to be installed and loaded. Its options control the embedded formatting behavior.
|
|
475
|
+
|
|
476
|
+
The formatter uses the source block's line breaks to choose its layout. Write block bodies across lines for consistent formatting when their content wraps.
|
|
403
477
|
|
|
404
478
|
#### JSON
|
|
405
479
|
|
|
@@ -415,26 +489,13 @@ Formatting embedded Java language requires the [`prettier-plugin-java`](https://
|
|
|
415
489
|
- **Default**: [`["json", "jsonl"]`](./src/embedded/json/options.ts)
|
|
416
490
|
- **Description**: Tags that make their subsequent template literals be identified as embedded JSON language.
|
|
417
491
|
|
|
418
|
-
##### ~~`embeddedJsonIdentifiers`~~
|
|
419
|
-
|
|
420
|
-
<details>
|
|
421
|
-
<summary>deprecated</summary>
|
|
422
|
-
|
|
423
|
-
- **Type**: `string[]`
|
|
424
|
-
- **Default**: [`["json", "jsonl"]`](./src/embedded/json/options.ts)
|
|
425
|
-
- **Description**: Comment or tag identifiers that make their subsequent template literals be identified as embedded JSON language.
|
|
426
|
-
|
|
427
|
-
Please use `embeddedJsonComments` or `embeddedJsonTags`.
|
|
428
|
-
|
|
429
|
-
</details>
|
|
430
|
-
|
|
431
492
|
##### `embeddedJsonParser`
|
|
432
493
|
|
|
433
494
|
- **Type**: [`"json" | "json5" | "jsonc" | "json-stringify"`](./src/embedded/json/options.ts)
|
|
434
495
|
- **Default**: [`"json"`](./src/embedded/json/options.ts)
|
|
435
496
|
- **Description**: The parser used to parse the embedded JSON language.
|
|
436
497
|
|
|
437
|
-
|
|
498
|
+
Embedded JSON uses the parsers and printers included with Prettier.
|
|
438
499
|
|
|
439
500
|
If you want to specify different parsers for different comments or tags, check [`embeddedOverrides`](#embeddedoverrides-1).
|
|
440
501
|
|
|
@@ -444,28 +505,31 @@ If you want to specify different parsers for different comments or tags, check [
|
|
|
444
505
|
|
|
445
506
|
- **Type**: `string[]`
|
|
446
507
|
- **Default**: [`["jsonata"]`](./src/embedded/jsonata/options.ts)
|
|
447
|
-
- **Description**: Block comments that make their subsequent template literals be identified as embedded JSONata language. This option requires the `@stedi/prettier-plugin-jsonata` plugin.
|
|
508
|
+
- **Description**: Block comments that make their subsequent template literals be identified as embedded JSONata language. This option requires the [`@stedi/prettier-plugin-jsonata`](https://www.npmjs.com/package/@stedi/prettier-plugin-jsonata) plugin.
|
|
448
509
|
|
|
449
510
|
##### `embeddedJsonataTags`
|
|
450
511
|
|
|
451
512
|
- **Type**: `string[]`
|
|
452
513
|
- **Default**: [`["jsonata"]`](./src/embedded/jsonata/options.ts)
|
|
453
|
-
- **Description**: Tags that make their subsequent template literals be identified as embedded JSONata language. This option requires the `@stedi/prettier-plugin-jsonata` plugin.
|
|
514
|
+
- **Description**: Tags that make their subsequent template literals be identified as embedded JSONata language. This option requires the [`@stedi/prettier-plugin-jsonata`](https://www.npmjs.com/package/@stedi/prettier-plugin-jsonata) plugin.
|
|
454
515
|
|
|
455
|
-
|
|
516
|
+
Formatting embedded JSONata language requires the [`@stedi/prettier-plugin-jsonata`](https://www.npmjs.com/package/@stedi/prettier-plugin-jsonata) plugin to be loaded as well.
|
|
456
517
|
|
|
457
|
-
|
|
458
|
-
|
|
518
|
+
#### JTE
|
|
519
|
+
|
|
520
|
+
##### `embeddedJteComments`
|
|
459
521
|
|
|
460
522
|
- **Type**: `string[]`
|
|
461
|
-
- **Default**: [`["
|
|
462
|
-
- **Description**:
|
|
523
|
+
- **Default**: [`["jte"]`](./src/embedded/jte/options.ts)
|
|
524
|
+
- **Description**: Block comments that identify embedded JTE in template literals. Requires the [`prettier-plugin-jte`](https://github.com/sgruendel/prettier-plugin-jte#readme) plugin.
|
|
463
525
|
|
|
464
|
-
|
|
526
|
+
##### `embeddedJteTags`
|
|
465
527
|
|
|
466
|
-
|
|
528
|
+
- **Type**: `string[]`
|
|
529
|
+
- **Default**: [`["jte"]`](./src/embedded/jte/options.ts)
|
|
530
|
+
- **Description**: Tags that identify embedded JTE in template literals. Requires the [`prettier-plugin-jte`](https://github.com/sgruendel/prettier-plugin-jte#readme) plugin.
|
|
467
531
|
|
|
468
|
-
Formatting embedded
|
|
532
|
+
Formatting embedded JTE requires the [`prettier-plugin-jte`](https://github.com/sgruendel/prettier-plugin-jte#readme) plugin to be installed and loaded. Its options control the embedded formatting behavior.
|
|
469
533
|
|
|
470
534
|
#### LaTeX
|
|
471
535
|
|
|
@@ -473,28 +537,31 @@ Formatting embedded JSONata language requires the [`@stedi/prettier-plugin-jsona
|
|
|
473
537
|
|
|
474
538
|
- **Type**: `string[]`
|
|
475
539
|
- **Default**: [`["latex", "tex", "aux", "cls", "bbl", "bib", "toc", "sty"]`](./src/embedded/latex/options.ts)
|
|
476
|
-
- **Description**: Block comments that make their subsequent template literals be identified as embedded LaTeX language. This option requires the `prettier-plugin-latex` plugin.
|
|
540
|
+
- **Description**: Block comments that make their subsequent template literals be identified as embedded LaTeX language. This option requires the [`prettier-plugin-latex`](https://github.com/siefkenj/prettier-plugin-latex#readme) plugin.
|
|
477
541
|
|
|
478
542
|
##### `embeddedLatexTags`
|
|
479
543
|
|
|
480
544
|
- **Type**: `string[]`
|
|
481
545
|
- **Default**: [`["latex", "tex", "aux", "cls", "bbl", "bib", "toc", "sty"]`](./src/embedded/latex/options.ts)
|
|
482
|
-
- **Description**: Tags that make their subsequent template literals be identified as embedded LaTeX language. This option requires the `prettier-plugin-latex` plugin.
|
|
546
|
+
- **Description**: Tags that make their subsequent template literals be identified as embedded LaTeX language. This option requires the [`prettier-plugin-latex`](https://github.com/siefkenj/prettier-plugin-latex#readme) plugin.
|
|
483
547
|
|
|
484
|
-
|
|
548
|
+
Formatting embedded LaTeX language requires the [`prettier-plugin-latex`](https://github.com/siefkenj/prettier-plugin-latex#readme) plugin to be loaded as well.
|
|
485
549
|
|
|
486
|
-
|
|
487
|
-
|
|
550
|
+
#### Liquid
|
|
551
|
+
|
|
552
|
+
##### `embeddedLiquidComments`
|
|
488
553
|
|
|
489
554
|
- **Type**: `string[]`
|
|
490
|
-
- **Default**: [`["
|
|
491
|
-
- **Description**:
|
|
555
|
+
- **Default**: [`["liquid"]`](./src/embedded/liquid/options.ts)
|
|
556
|
+
- **Description**: Block comments that identify embedded Liquid in template literals. Requires the [`@shopify/prettier-plugin-liquid`](https://github.com/Shopify/theme-tools/tree/main/packages/prettier-plugin-liquid#readme) plugin.
|
|
492
557
|
|
|
493
|
-
|
|
558
|
+
##### `embeddedLiquidTags`
|
|
494
559
|
|
|
495
|
-
|
|
560
|
+
- **Type**: `string[]`
|
|
561
|
+
- **Default**: [`["liquid"]`](./src/embedded/liquid/options.ts)
|
|
562
|
+
- **Description**: Tags that identify embedded Liquid in template literals. Requires the [`@shopify/prettier-plugin-liquid`](https://github.com/Shopify/theme-tools/tree/main/packages/prettier-plugin-liquid#readme) plugin.
|
|
496
563
|
|
|
497
|
-
Formatting embedded
|
|
564
|
+
Formatting embedded Liquid requires the [`@shopify/prettier-plugin-liquid`](https://github.com/Shopify/theme-tools/tree/main/packages/prettier-plugin-liquid#readme) plugin to be installed and loaded. Its options control the embedded formatting behavior.
|
|
498
565
|
|
|
499
566
|
#### Markdown
|
|
500
567
|
|
|
@@ -510,26 +577,13 @@ Formatting embedded LaTeX language requires the [`prettier-plugin-latex`](https:
|
|
|
510
577
|
- **Default**: [`["md", "markdown"]`](./src/embedded/markdown/options.ts)
|
|
511
578
|
- **Description**: Tags that make their subsequent template literals be identified as embedded Markdown language.
|
|
512
579
|
|
|
513
|
-
##### ~~`embeddedMarkdownIdentifiers`~~
|
|
514
|
-
|
|
515
|
-
<details>
|
|
516
|
-
<summary>deprecated</summary>
|
|
517
|
-
|
|
518
|
-
- **Type**: `string[]`
|
|
519
|
-
- **Default**: [`["md", "markdown"]`](./src/embedded/markdown/options.ts)
|
|
520
|
-
- **Description**: Comment or tag identifiers that make their subsequent template literals be identified as embedded Markdown language.
|
|
521
|
-
|
|
522
|
-
Please use `embeddedMarkdownComments` or `embeddedMarkdownTags`.
|
|
523
|
-
|
|
524
|
-
</details>
|
|
525
|
-
|
|
526
580
|
##### `embeddedMarkdownParser`
|
|
527
581
|
|
|
528
582
|
- **Type**: [`"markdown" | "mdx" | "remark"`](./src/embedded/markdown/options.ts)
|
|
529
583
|
- **Default**: [`"markdown"`](./src/embedded/markdown/options.ts)
|
|
530
584
|
- **Description**: The parser used to parse the embedded Markdown language.
|
|
531
585
|
|
|
532
|
-
|
|
586
|
+
Embedded Markdown uses the parsers and printers included with Prettier.
|
|
533
587
|
|
|
534
588
|
This can override the native formatting for embedded Markdown language. If you want to keep the native behavior, set `embeddedMarkdownComments` or `embeddedMarkdownTags` to `[]` or other values.
|
|
535
589
|
|
|
@@ -537,34 +591,85 @@ If you want to specify different parsers for different comments or tags, check [
|
|
|
537
591
|
|
|
538
592
|
The `remark` parser is [an alias of the `markdown` parser](https://github.com/prettier/prettier/blob/ed23dacc9e655c3876971b30859497b17ff2cf9f/src/language-markdown/parser-markdown.js#L57).
|
|
539
593
|
|
|
594
|
+
#### Marko
|
|
595
|
+
|
|
596
|
+
##### `embeddedMarkoComments`
|
|
597
|
+
|
|
598
|
+
- **Type**: `string[]`
|
|
599
|
+
- **Default**: [`["marko"]`](./src/embedded/marko/options.ts)
|
|
600
|
+
- **Description**: Block comments that identify embedded Marko in template literals. Requires the [`prettier-plugin-marko`](https://github.com/marko-js/prettier#readme) plugin.
|
|
601
|
+
|
|
602
|
+
##### `embeddedMarkoTags`
|
|
603
|
+
|
|
604
|
+
- **Type**: `string[]`
|
|
605
|
+
- **Default**: [`["marko"]`](./src/embedded/marko/options.ts)
|
|
606
|
+
- **Description**: Tags that identify embedded Marko in template literals. Requires the [`prettier-plugin-marko`](https://github.com/marko-js/prettier#readme) plugin.
|
|
607
|
+
|
|
608
|
+
Formatting embedded Marko requires the [`prettier-plugin-marko`](https://github.com/marko-js/prettier#readme) plugin to be installed and loaded. Its options control the embedded formatting behavior.
|
|
609
|
+
|
|
610
|
+
#### Motoko
|
|
611
|
+
|
|
612
|
+
##### `embeddedMotokoComments`
|
|
613
|
+
|
|
614
|
+
- **Type**: `string[]`
|
|
615
|
+
- **Default**: [`["motoko", "mo"]`](./src/embedded/motoko/options.ts)
|
|
616
|
+
- **Description**: Block comments that identify embedded Motoko in template literals. Requires the [`prettier-plugin-motoko`](https://github.com/caffeinelabs/prettier-plugin-motoko#readme) plugin.
|
|
617
|
+
|
|
618
|
+
##### `embeddedMotokoTags`
|
|
619
|
+
|
|
620
|
+
- **Type**: `string[]`
|
|
621
|
+
- **Default**: [`["motoko", "mo"]`](./src/embedded/motoko/options.ts)
|
|
622
|
+
- **Description**: Tags that identify embedded Motoko in template literals. Requires the [`prettier-plugin-motoko`](https://github.com/caffeinelabs/prettier-plugin-motoko#readme) plugin.
|
|
623
|
+
|
|
624
|
+
Formatting embedded Motoko requires the [`prettier-plugin-motoko`](https://github.com/caffeinelabs/prettier-plugin-motoko#readme) plugin to be installed and loaded. Its options control the embedded formatting behavior.
|
|
625
|
+
|
|
626
|
+
#### Mustache
|
|
627
|
+
|
|
628
|
+
##### `embeddedMustacheComments`
|
|
629
|
+
|
|
630
|
+
- **Type**: `string[]`
|
|
631
|
+
- **Default**: [`["mustache"]`](./src/embedded/mustache/options.ts)
|
|
632
|
+
- **Description**: Block comments that identify embedded Mustache in template literals. Requires the [`prettier-plugin-mustache`](https://github.com/Poliklot/prettier-plugin-mustache#readme) plugin.
|
|
633
|
+
|
|
634
|
+
##### `embeddedMustacheTags`
|
|
635
|
+
|
|
636
|
+
- **Type**: `string[]`
|
|
637
|
+
- **Default**: [`["mustache"]`](./src/embedded/mustache/options.ts)
|
|
638
|
+
- **Description**: Tags that identify embedded Mustache in template literals. Requires the [`prettier-plugin-mustache`](https://github.com/Poliklot/prettier-plugin-mustache#readme) plugin.
|
|
639
|
+
|
|
640
|
+
Formatting embedded Mustache requires the [`prettier-plugin-mustache`](https://github.com/Poliklot/prettier-plugin-mustache#readme) plugin to be installed and loaded. Its options control the embedded formatting behavior.
|
|
641
|
+
|
|
540
642
|
#### NGINX
|
|
541
643
|
|
|
542
644
|
##### `embeddedNginxComments`
|
|
543
645
|
|
|
544
646
|
- **Type**: `string[]`
|
|
545
647
|
- **Default**: [`["nginx"]`](./src/embedded/nginx/options.ts)
|
|
546
|
-
- **Description**: Block comments that make their subsequent template literals be identified as embedded NGINX language. This option requires the `prettier-plugin-nginx` plugin.
|
|
648
|
+
- **Description**: Block comments that make their subsequent template literals be identified as embedded NGINX language. This option requires the [`prettier-plugin-nginx`](https://github.com/jxddk/prettier-plugin-nginx#readme) plugin.
|
|
547
649
|
|
|
548
650
|
##### `embeddedNginxTags`
|
|
549
651
|
|
|
550
652
|
- **Type**: `string[]`
|
|
551
653
|
- **Default**: [`["nginx"]`](./src/embedded/nginx/options.ts)
|
|
552
|
-
- **Description**: Tags that make their subsequent template literals be identified as embedded NGINX language. This option requires the `prettier-plugin-nginx` plugin.
|
|
654
|
+
- **Description**: Tags that make their subsequent template literals be identified as embedded NGINX language. This option requires the [`prettier-plugin-nginx`](https://github.com/jxddk/prettier-plugin-nginx#readme) plugin.
|
|
553
655
|
|
|
554
|
-
|
|
656
|
+
Formatting embedded NGINX language requires the [`prettier-plugin-nginx`](https://github.com/jxddk/prettier-plugin-nginx#readme) plugin to be loaded as well. And [options](https://github.com/jxddk/prettier-plugin-nginx?tab=readme-ov-file#configuration) supported by `prettier-plugin-nginx` can therefore be used to further control the formatting behavior.
|
|
555
657
|
|
|
556
|
-
|
|
557
|
-
|
|
658
|
+
#### Nunjucks
|
|
659
|
+
|
|
660
|
+
##### `embeddedNunjucksComments`
|
|
558
661
|
|
|
559
662
|
- **Type**: `string[]`
|
|
560
|
-
- **Default**: [`["
|
|
561
|
-
- **Description**:
|
|
663
|
+
- **Default**: [`["nunjucks", "njk"]`](./src/embedded/nunjucks/options.ts)
|
|
664
|
+
- **Description**: Block comments that identify embedded Nunjucks in template literals. Requires the [`prettier-plugin-nunjucks`](https://github.com/Poliklot/prettier-plugin-nunjucks#readme) plugin.
|
|
562
665
|
|
|
563
|
-
|
|
666
|
+
##### `embeddedNunjucksTags`
|
|
564
667
|
|
|
565
|
-
|
|
668
|
+
- **Type**: `string[]`
|
|
669
|
+
- **Default**: [`["nunjucks", "njk"]`](./src/embedded/nunjucks/options.ts)
|
|
670
|
+
- **Description**: Tags that identify embedded Nunjucks in template literals. Requires the [`prettier-plugin-nunjucks`](https://github.com/Poliklot/prettier-plugin-nunjucks#readme) plugin.
|
|
566
671
|
|
|
567
|
-
Formatting embedded
|
|
672
|
+
Formatting embedded Nunjucks requires the [`prettier-plugin-nunjucks`](https://github.com/Poliklot/prettier-plugin-nunjucks#readme) plugin to be installed and loaded. Its options control the embedded formatting behavior.
|
|
568
673
|
|
|
569
674
|
#### Pegjs
|
|
570
675
|
|
|
@@ -572,28 +677,15 @@ Formatting embedded NGINX language requires the [`prettier-plugin-nginx`](https:
|
|
|
572
677
|
|
|
573
678
|
- **Type**: `string[]`
|
|
574
679
|
- **Default**: [`["pegjs", "peggy", "peg"]`](./src/embedded/pegjs/options.ts)
|
|
575
|
-
- **Description**: Block comments that make their subsequent template literals be identified as embedded Pegjs language. This option requires the `prettier-plugin-pegjs` plugin.
|
|
680
|
+
- **Description**: Block comments that make their subsequent template literals be identified as embedded Pegjs language. This option requires the [`prettier-plugin-pegjs`](https://github.com/siefkenj/prettier-plugin-pegjs#readme) plugin.
|
|
576
681
|
|
|
577
682
|
##### `embeddedPegjsTags`
|
|
578
683
|
|
|
579
684
|
- **Type**: `string[]`
|
|
580
685
|
- **Default**: [`["pegjs", "peggy", "peg"]`](./src/embedded/pegjs/options.ts)
|
|
581
|
-
- **Description**: Tags that make their subsequent template literals be identified as embedded Pegjs language. This option requires the `prettier-plugin-pegjs` plugin.
|
|
582
|
-
|
|
583
|
-
##### ~~`embeddedPegjsIdentifiers`~~
|
|
584
|
-
|
|
585
|
-
<details>
|
|
586
|
-
<summary>deprecated</summary>
|
|
587
|
-
|
|
588
|
-
- **Type**: `string[]`
|
|
589
|
-
- **Default**: [`["pegjs", "peggy", "peg"]`](./src/embedded/pegjs/options.ts)
|
|
590
|
-
- **Description**: Comment or tag identifiers that make their subsequent template literals be identified as embedded Pegjs language. This option requires the `prettier-plugin-pegjs` plugin.
|
|
591
|
-
|
|
592
|
-
Please use `embeddedPegjsComments` or `embeddedPegjsTags`.
|
|
686
|
+
- **Description**: Tags that make their subsequent template literals be identified as embedded Pegjs language. This option requires the [`prettier-plugin-pegjs`](https://github.com/siefkenj/prettier-plugin-pegjs#readme) plugin.
|
|
593
687
|
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
Formatting embedded Pegjs language requires the [`prettier-plugin-pegjs`](https://github.com/siefkenj/prettier-plugin-pegjs) plugin to be loaded as well. And [options](https://github.com/siefkenj/prettier-plugin-pegjs?tab=readme-ov-file#options) supported by `prettier-plugin-pegjs` can therefore be used to further control the formatting behavior.
|
|
688
|
+
Formatting embedded Pegjs language requires the [`prettier-plugin-pegjs`](https://github.com/siefkenj/prettier-plugin-pegjs#readme) plugin to be loaded as well. And [options](https://github.com/siefkenj/prettier-plugin-pegjs?tab=readme-ov-file#options) supported by `prettier-plugin-pegjs` can therefore be used to further control the formatting behavior.
|
|
597
689
|
|
|
598
690
|
Note that `prettier-plugin-pegjs` supports different parsers for the action blocks and they are specified by the [`actionParser` option](https://github.com/siefkenj/prettier-plugin-pegjs?tab=readme-ov-file#options). If you want to specify different action parsers for different comments or tags, check [`embeddedOverrides`](#embeddedoverrides-1).
|
|
599
691
|
|
|
@@ -603,28 +695,31 @@ Note that `prettier-plugin-pegjs` supports different parsers for the action bloc
|
|
|
603
695
|
|
|
604
696
|
- **Type**: `string[]`
|
|
605
697
|
- **Default**: [`["php", "php5"]`](./src/embedded/php/options.ts)
|
|
606
|
-
- **Description**: Block comments that make their subsequent template literals be identified as embedded PHP language. This option requires the `@prettier/plugin-php` plugin.
|
|
698
|
+
- **Description**: Block comments that make their subsequent template literals be identified as embedded PHP language. This option requires the [`@prettier/plugin-php`](https://github.com/prettier/plugin-php#readme) plugin.
|
|
607
699
|
|
|
608
700
|
##### `embeddedPhpTags`
|
|
609
701
|
|
|
610
702
|
- **Type**: `string[]`
|
|
611
703
|
- **Default**: [`["php", "php5"]`](./src/embedded/php/options.ts)
|
|
612
|
-
- **Description**: Tags that make their subsequent template literals be identified as embedded PHP language. This option requires the `@prettier/plugin-php` plugin.
|
|
704
|
+
- **Description**: Tags that make their subsequent template literals be identified as embedded PHP language. This option requires the [`@prettier/plugin-php`](https://github.com/prettier/plugin-php#readme) plugin.
|
|
613
705
|
|
|
614
|
-
|
|
706
|
+
Formatting embedded PHP language requires the [`@prettier/plugin-php`](https://github.com/prettier/plugin-php#readme) plugin to be loaded as well. And [options](https://github.com/prettier/plugin-php#configuration) supported by `@prettier/plugin-php` can therefore be used to further control the formatting behavior.
|
|
615
707
|
|
|
616
|
-
|
|
617
|
-
|
|
708
|
+
#### PowerShell
|
|
709
|
+
|
|
710
|
+
##### `embeddedPowerShellComments`
|
|
618
711
|
|
|
619
712
|
- **Type**: `string[]`
|
|
620
|
-
- **Default**: [`["
|
|
621
|
-
- **Description**:
|
|
713
|
+
- **Default**: [`["powershell", "ps1"]`](./src/embedded/powershell/options.ts)
|
|
714
|
+
- **Description**: Block comments that identify embedded PowerShell in template literals. Requires the [`prettier-plugin-powershell`](https://github.com/Nick2bad4u/Prettier-Plugin-Powershell#readme) plugin.
|
|
622
715
|
|
|
623
|
-
|
|
716
|
+
##### `embeddedPowerShellTags`
|
|
624
717
|
|
|
625
|
-
|
|
718
|
+
- **Type**: `string[]`
|
|
719
|
+
- **Default**: [`["powershell", "ps1"]`](./src/embedded/powershell/options.ts)
|
|
720
|
+
- **Description**: Tags that identify embedded PowerShell in template literals. Requires the [`prettier-plugin-powershell`](https://github.com/Nick2bad4u/Prettier-Plugin-Powershell#readme) plugin.
|
|
626
721
|
|
|
627
|
-
Formatting embedded
|
|
722
|
+
Formatting embedded PowerShell requires the [`prettier-plugin-powershell`](https://github.com/Nick2bad4u/Prettier-Plugin-Powershell#readme) plugin to be installed and loaded. Its options control the embedded formatting behavior.
|
|
628
723
|
|
|
629
724
|
#### Prisma
|
|
630
725
|
|
|
@@ -632,28 +727,15 @@ Formatting embedded PHP language requires the [`@prettier/plugin-php`](https://g
|
|
|
632
727
|
|
|
633
728
|
- **Type**: `string[]`
|
|
634
729
|
- **Default**: [`["prisma"]`](./src/embedded/prisma/options.ts)
|
|
635
|
-
- **Description**: Block comments that make their subsequent template literals be identified as embedded Prisma language. This option requires the `prettier-plugin-prisma` plugin.
|
|
730
|
+
- **Description**: Block comments that make their subsequent template literals be identified as embedded Prisma language. This option requires the [`prettier-plugin-prisma`](https://github.com/avocadowastaken/prettier-plugin-prisma#readme) plugin.
|
|
636
731
|
|
|
637
732
|
##### `embeddedPrismaTags`
|
|
638
733
|
|
|
639
734
|
- **Type**: `string[]`
|
|
640
735
|
- **Default**: [`["prisma"]`](./src/embedded/prisma/options.ts)
|
|
641
|
-
- **Description**: Tags that make their subsequent template literals be identified as embedded Prisma language. This option requires the `prettier-plugin-prisma` plugin.
|
|
736
|
+
- **Description**: Tags that make their subsequent template literals be identified as embedded Prisma language. This option requires the [`prettier-plugin-prisma`](https://github.com/avocadowastaken/prettier-plugin-prisma#readme) plugin.
|
|
642
737
|
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
<details>
|
|
646
|
-
<summary>deprecated</summary>
|
|
647
|
-
|
|
648
|
-
- **Type**: `string[]`
|
|
649
|
-
- **Default**: [`["prisma"]`](./src/embedded/prisma/options.ts)
|
|
650
|
-
- **Description**: Comment or tag identifiers that make their subsequent template literals be identified as embedded Prisma language. This option requires the `prettier-plugin-prisma` plugin.
|
|
651
|
-
|
|
652
|
-
Please use `embeddedPrismaComments` or `embeddedPrismaTags`.
|
|
653
|
-
|
|
654
|
-
</details>
|
|
655
|
-
|
|
656
|
-
Formatting embedded Prisma language requires the [`prettier-plugin-prisma`](https://github.com/avocadowastaken/prettier-plugin-prisma) plugin to be loaded as well.
|
|
738
|
+
Formatting embedded Prisma language requires the [`prettier-plugin-prisma`](https://github.com/avocadowastaken/prettier-plugin-prisma#readme) plugin to be loaded as well.
|
|
657
739
|
|
|
658
740
|
#### Properties
|
|
659
741
|
|
|
@@ -661,28 +743,15 @@ Formatting embedded Prisma language requires the [`prettier-plugin-prisma`](http
|
|
|
661
743
|
|
|
662
744
|
- **Type**: `string[]`
|
|
663
745
|
- **Default**: [`["properties"]`](./src/embedded/properties/options.ts)
|
|
664
|
-
- **Description**: Block comments that make their subsequent template literals be identified as embedded Properties language. This option requires the `prettier-plugin-properties` plugin.
|
|
746
|
+
- **Description**: Block comments that make their subsequent template literals be identified as embedded Properties language. This option requires the [`prettier-plugin-properties`](https://github.com/eemeli/prettier-plugin-properties#readme) plugin.
|
|
665
747
|
|
|
666
748
|
##### `embeddedPropertiesTags`
|
|
667
749
|
|
|
668
750
|
- **Type**: `string[]`
|
|
669
751
|
- **Default**: [`["properties"]`](./src/embedded/properties/options.ts)
|
|
670
|
-
- **Description**: Tags that make their subsequent template literals be identified as embedded Properties language. This option requires the `prettier-plugin-properties` plugin.
|
|
671
|
-
|
|
672
|
-
##### ~~`embeddedPropertiesIdentifiers`~~
|
|
752
|
+
- **Description**: Tags that make their subsequent template literals be identified as embedded Properties language. This option requires the [`prettier-plugin-properties`](https://github.com/eemeli/prettier-plugin-properties#readme) plugin.
|
|
673
753
|
|
|
674
|
-
|
|
675
|
-
<summary>deprecated</summary>
|
|
676
|
-
|
|
677
|
-
- **Type**: `string[]`
|
|
678
|
-
- **Default**: [`["properties"]`](./src/embedded/properties/options.ts)
|
|
679
|
-
- **Description**: Comment or tag identifiers that make their subsequent template literals be identified as embedded Properties language. This option requires the `prettier-plugin-properties` plugin.
|
|
680
|
-
|
|
681
|
-
Please use `embeddedPropertiesComments` or `embeddedPropertiesTags`.
|
|
682
|
-
|
|
683
|
-
</details>
|
|
684
|
-
|
|
685
|
-
Formatting embedded Properties language requires the [`prettier-plugin-properties`](https://github.com/eemeli/prettier-plugin-properties) plugin to be loaded as well. And [options](https://github.com/eemeli/prettier-plugin-properties#configuration) supported by `prettier-plugin-properties` can therefore be used to further control the formatting behavior.
|
|
754
|
+
Formatting embedded Properties language requires the [`prettier-plugin-properties`](https://github.com/eemeli/prettier-plugin-properties#readme) plugin to be loaded as well. And [options](https://github.com/eemeli/prettier-plugin-properties#configuration) supported by `prettier-plugin-properties` can therefore be used to further control the formatting behavior.
|
|
686
755
|
|
|
687
756
|
#### Pug
|
|
688
757
|
|
|
@@ -690,28 +759,15 @@ Formatting embedded Properties language requires the [`prettier-plugin-propertie
|
|
|
690
759
|
|
|
691
760
|
- **Type**: `string[]`
|
|
692
761
|
- **Default**: [`["pug", "jade"]`](./src/embedded/pug/options.ts)
|
|
693
|
-
- **Description**: Block comments that make their subsequent template literals be identified as embedded Pug language. This option requires the `@prettier/plugin-pug` plugin.
|
|
762
|
+
- **Description**: Block comments that make their subsequent template literals be identified as embedded Pug language. This option requires the [`@prettier/plugin-pug`](https://github.com/prettier/plugin-pug#readme) plugin.
|
|
694
763
|
|
|
695
764
|
##### `embeddedPugTags`
|
|
696
765
|
|
|
697
766
|
- **Type**: `string[]`
|
|
698
767
|
- **Default**: [`["pug", "jade"]`](./src/embedded/pug/options.ts)
|
|
699
|
-
- **Description**: Tags that make their subsequent template literals be identified as embedded Pug language. This option requires the `@prettier/plugin-pug` plugin.
|
|
700
|
-
|
|
701
|
-
##### ~~`embeddedPugIdentifiers`~~
|
|
768
|
+
- **Description**: Tags that make their subsequent template literals be identified as embedded Pug language. This option requires the [`@prettier/plugin-pug`](https://github.com/prettier/plugin-pug#readme) plugin.
|
|
702
769
|
|
|
703
|
-
|
|
704
|
-
<summary>deprecated</summary>
|
|
705
|
-
|
|
706
|
-
- **Type**: `string[]`
|
|
707
|
-
- **Default**: [`["pug", "jade"]`](./src/embedded/pug/options.ts)
|
|
708
|
-
- **Description**: Comment or tag identifiers that make their subsequent template literals be identified as embedded Pug language. This option requires the `@prettier/plugin-pug` plugin.
|
|
709
|
-
|
|
710
|
-
Please use `embeddedPugComments` or `embeddedPugTags`.
|
|
711
|
-
|
|
712
|
-
</details>
|
|
713
|
-
|
|
714
|
-
Formatting embedded Pug language requires the [`@prettier/plugin-pug`](https://github.com/prettier/plugin-pug) plugin to be loaded as well. And [options](https://github.com/prettier/plugin-pug?tab=readme-ov-file#configuration) supported by `@prettier/plugin-pug` can therefore be used to further control the formatting behavior.
|
|
770
|
+
Formatting embedded Pug language requires the [`@prettier/plugin-pug`](https://github.com/prettier/plugin-pug#readme) plugin to be loaded as well. And [options](https://github.com/prettier/plugin-pug?tab=readme-ov-file#configuration) supported by `@prettier/plugin-pug` can therefore be used to further control the formatting behavior.
|
|
715
771
|
|
|
716
772
|
#### Ruby
|
|
717
773
|
|
|
@@ -719,34 +775,21 @@ Formatting embedded Pug language requires the [`@prettier/plugin-pug`](https://g
|
|
|
719
775
|
|
|
720
776
|
- **Type**: `string[]`
|
|
721
777
|
- **Default**: [`["ruby"]`](./src/embedded/ruby/options.ts)
|
|
722
|
-
- **Description**: Block comments that make their subsequent template literals be identified as embedded Ruby language. This option requires the `@prettier/plugin-ruby` plugin.
|
|
778
|
+
- **Description**: Block comments that make their subsequent template literals be identified as embedded Ruby language. This option requires the [`@prettier/plugin-ruby`](https://github.com/prettier/plugin-ruby#readme) plugin.
|
|
723
779
|
|
|
724
780
|
##### `embeddedRubyTags`
|
|
725
781
|
|
|
726
782
|
- **Type**: `string[]`
|
|
727
783
|
- **Default**: [`["ruby"]`](./src/embedded/ruby/options.ts)
|
|
728
|
-
- **Description**: Tags that make their subsequent template literals be identified as embedded Ruby language. This option requires the `@prettier/plugin-ruby` plugin.
|
|
729
|
-
|
|
730
|
-
##### ~~`embeddedRubyIdentifiers`~~
|
|
731
|
-
|
|
732
|
-
<details>
|
|
733
|
-
<summary>deprecated</summary>
|
|
734
|
-
|
|
735
|
-
- **Type**: `string[]`
|
|
736
|
-
- **Default**: [`["ruby"]`](./src/embedded/ruby/options.ts)
|
|
737
|
-
- **Description**: Comment or tag identifiers that make their subsequent template literals be identified as embedded Ruby language. This option requires the `@prettier/plugin-ruby` plugin.
|
|
738
|
-
|
|
739
|
-
Please use `embeddedRubyComments` or `embeddedRubyTags`.
|
|
740
|
-
|
|
741
|
-
</details>
|
|
784
|
+
- **Description**: Tags that make their subsequent template literals be identified as embedded Ruby language. This option requires the [`@prettier/plugin-ruby`](https://github.com/prettier/plugin-ruby#readme) plugin.
|
|
742
785
|
|
|
743
786
|
##### `embeddedRubyParser`
|
|
744
787
|
|
|
745
788
|
- **Type**: [`"ruby" | "rbs" | "haml"`](./src/embedded/ruby/options.ts)
|
|
746
789
|
- **Default**: [`"ruby"`](./src/embedded/ruby/options.ts)
|
|
747
|
-
- **Description**: The parser used to parse the embedded Ruby language. This option requires the `@prettier/plugin-ruby` plugin.
|
|
790
|
+
- **Description**: The parser used to parse the embedded Ruby language. This option requires the [`@prettier/plugin-ruby`](https://github.com/prettier/plugin-ruby#readme) plugin.
|
|
748
791
|
|
|
749
|
-
Formatting embedded Ruby language requires the [`@prettier/plugin-ruby`](https://github.com/prettier/plugin-ruby) to be loaded and [its dependencies to be installed](https://github.com/prettier/plugin-ruby#getting-started) as well. And [options](https://github.com/prettier/plugin-ruby#configuration) supported by `@prettier/plugin-ruby` can therefore be used to further control the formatting behavior.
|
|
792
|
+
Formatting embedded Ruby language requires the [`@prettier/plugin-ruby`](https://github.com/prettier/plugin-ruby#readme) to be loaded and [its dependencies to be installed](https://github.com/prettier/plugin-ruby#getting-started) as well. And [options](https://github.com/prettier/plugin-ruby#configuration) supported by `@prettier/plugin-ruby` can therefore be used to further control the formatting behavior.
|
|
750
793
|
|
|
751
794
|
If you want to specify different parsers for different comments or tags, check [`embeddedOverrides`](#embeddedoverrides-1).
|
|
752
795
|
|
|
@@ -756,30 +799,41 @@ If you want to specify different parsers for different comments or tags, check [
|
|
|
756
799
|
|
|
757
800
|
- **Type**: `string[]`
|
|
758
801
|
- **Default**: [`["sh"]`](./src/embedded/sh/options.ts)
|
|
759
|
-
- **Description**: Block comments that make their subsequent template literals be identified as embedded Shell language. This option requires the `prettier-plugin-sh` plugin.
|
|
802
|
+
- **Description**: Block comments that make their subsequent template literals be identified as embedded Shell language. This option requires the [`prettier-plugin-sh`](https://github.com/un-ts/prettier/tree/master/packages/sh#readme) plugin.
|
|
760
803
|
|
|
761
804
|
##### `embeddedShTags`
|
|
762
805
|
|
|
763
806
|
- **Type**: `string[]`
|
|
764
807
|
- **Default**: [`["sh"]`](./src/embedded/sh/options.ts)
|
|
765
|
-
- **Description**: Tags that make their subsequent template literals be identified as embedded Shell language. This option requires the `prettier-plugin-sh` plugin.
|
|
808
|
+
- **Description**: Tags that make their subsequent template literals be identified as embedded Shell language. This option requires the [`prettier-plugin-sh`](https://github.com/un-ts/prettier/tree/master/packages/sh#readme) plugin.
|
|
766
809
|
|
|
767
|
-
|
|
810
|
+
Formatting embedded Shell language requires the [`prettier-plugin-sh`](https://github.com/un-ts/prettier/tree/master/packages/sh#readme) plugin to be loaded as well. And [options](https://github.com/un-ts/prettier/tree/master/packages/sh#parser-options) supported by `prettier-plugin-sh` can therefore be used to further control the formatting behavior.
|
|
768
811
|
|
|
769
|
-
|
|
770
|
-
|
|
812
|
+
Note that `prettier-plugin-sh` supports different variants of shell syntaxes and they are specified by the [`variant` option](https://github.com/un-ts/prettier/tree/master/packages/sh#parser-options). If you want to specify different variants for different comments or tags, check [`embeddedOverrides`](#embeddedoverrides-1).
|
|
813
|
+
|
|
814
|
+
#### Solidity
|
|
815
|
+
|
|
816
|
+
##### `embeddedSolidityComments`
|
|
771
817
|
|
|
772
818
|
- **Type**: `string[]`
|
|
773
|
-
- **Default**: [`["
|
|
774
|
-
- **Description**:
|
|
819
|
+
- **Default**: [`["solidity", "sol"]`](./src/embedded/solidity/options.ts)
|
|
820
|
+
- **Description**: Block comments that identify embedded Solidity in template literals. Requires the [`prettier-plugin-solidity`](https://github.com/prettier-solidity/prettier-plugin-solidity#readme) plugin.
|
|
775
821
|
|
|
776
|
-
|
|
822
|
+
##### `embeddedSolidityTags`
|
|
777
823
|
|
|
778
|
-
|
|
824
|
+
- **Type**: `string[]`
|
|
825
|
+
- **Default**: [`["solidity", "sol"]`](./src/embedded/solidity/options.ts)
|
|
826
|
+
- **Description**: Tags that identify embedded Solidity in template literals. Requires the [`prettier-plugin-solidity`](https://github.com/prettier-solidity/prettier-plugin-solidity#readme) plugin.
|
|
779
827
|
|
|
780
|
-
|
|
828
|
+
##### `embeddedSolidityParser`
|
|
781
829
|
|
|
782
|
-
|
|
830
|
+
- **Type**: [`"slang" | "antlr" | "solidity-parse"`](./src/embedded/solidity/options.ts)
|
|
831
|
+
- **Default**: [`"slang"`](./src/embedded/solidity/options.ts)
|
|
832
|
+
- **Description**: The parser used to format embedded Solidity.
|
|
833
|
+
|
|
834
|
+
Formatting embedded Solidity requires the [`prettier-plugin-solidity`](https://github.com/prettier-solidity/prettier-plugin-solidity#readme) plugin to be installed and loaded. Its options control the embedded formatting behavior.
|
|
835
|
+
|
|
836
|
+
Choose `"slang"` or `"antlr"` with current formatter versions. Formatter versions exposing `"solidity-parse"` use `embeddedSolidityParser: "solidity-parse"`.
|
|
783
837
|
|
|
784
838
|
#### SQL
|
|
785
839
|
|
|
@@ -787,32 +841,19 @@ Note that `prettier-plugin-sh` supports different variants of shell syntaxes and
|
|
|
787
841
|
|
|
788
842
|
- **Type**: `string[]`
|
|
789
843
|
- **Default**: [`["sql"]`](./src/embedded/sql/options.ts)
|
|
790
|
-
- **Description**: Block comments that make their subsequent template literals be identified as embedded SQL language. This option requires the `prettier-plugin-sql` plugin or the `prettier-plugin-sql-cst` plugin.
|
|
844
|
+
- **Description**: Block comments that make their subsequent template literals be identified as embedded SQL language. This option requires the [`prettier-plugin-sql`](https://github.com/un-ts/prettier/tree/master/packages/sql#readme) plugin or the [`prettier-plugin-sql-cst`](https://github.com/nene/prettier-plugin-sql-cst#readme) plugin.
|
|
791
845
|
|
|
792
846
|
##### `embeddedSqlTags`
|
|
793
847
|
|
|
794
848
|
- **Type**: `string[]`
|
|
795
849
|
- **Default**: [`["sql"]`](./src/embedded/sql/options.ts)
|
|
796
|
-
- **Description**: Tags that make their subsequent template literals be identified as embedded SQL language. This option requires the `prettier-plugin-sql` plugin or the `prettier-plugin-sql-cst` plugin.
|
|
797
|
-
|
|
798
|
-
##### ~~`embeddedSqlIdentifiers`~~
|
|
799
|
-
|
|
800
|
-
<details>
|
|
801
|
-
<summary>deprecated</summary>
|
|
802
|
-
|
|
803
|
-
- **Type**: `string[]`
|
|
804
|
-
- **Default**: [`["sql"]`](./src/embedded/sql/options.ts)
|
|
805
|
-
- **Description**: Comment or tag identifiers that make their subsequent template literals be identified as embedded SQL language. This option requires the `prettier-plugin-sql` plugin or the `prettier-plugin-sql-cst` plugin.
|
|
806
|
-
|
|
807
|
-
Please use `embeddedSqlComments` or `embeddedSqlTags`.
|
|
808
|
-
|
|
809
|
-
</details>
|
|
850
|
+
- **Description**: Tags that make their subsequent template literals be identified as embedded SQL language. This option requires the [`prettier-plugin-sql`](https://github.com/un-ts/prettier/tree/master/packages/sql#readme) plugin or the [`prettier-plugin-sql-cst`](https://github.com/nene/prettier-plugin-sql-cst#readme) plugin.
|
|
810
851
|
|
|
811
852
|
##### `embeddedSqlPlugin`
|
|
812
853
|
|
|
813
854
|
- **Type**: [`"prettier-plugin-sql" | "prettier-plugin-sql-cst"`](./src/embedded/sql/options.ts)
|
|
814
855
|
- **Default**: [`"prettier-plugin-sql"`](./src/embedded/sql/options.ts)
|
|
815
|
-
- **Description**: The plugin used to format the embedded SQL language. This option requires the `prettier-plugin-sql` plugin or the `prettier-plugin-sql-cst` plugin.
|
|
856
|
+
- **Description**: The plugin used to format the embedded SQL language. This option requires the [`prettier-plugin-sql`](https://github.com/un-ts/prettier/tree/master/packages/sql#readme) plugin or the [`prettier-plugin-sql-cst`](https://github.com/nene/prettier-plugin-sql-cst#readme) plugin.
|
|
816
857
|
|
|
817
858
|
##### `embeddedSqlParser`
|
|
818
859
|
|
|
@@ -820,36 +861,41 @@ Please use `embeddedSqlComments` or `embeddedSqlTags`.
|
|
|
820
861
|
- **Default**: [`"sqlite"`](./src/embedded/sql/options.ts)
|
|
821
862
|
- **Description**: Specify the embedded SQL language parser. This option is only needed with the `prettier-plugin-sql-cst` plugin.
|
|
822
863
|
|
|
823
|
-
Formatting embedded SQL language requires the [`prettier-plugin-sql`](https://github.com/un-ts/prettier/tree/master/packages/sql#readme) plugin or the [`prettier-plugin-sql-cst`](https://github.com/nene/prettier-plugin-sql-cst) plugin to be loaded as well. And [options](https://github.com/un-ts/prettier/tree/master/packages/sql#parser-options) supported by `prettier-plugin-sql`, or [options](https://github.com/nene/prettier-plugin-sql-cst?tab=readme-ov-file#configuration) supported by `prettier-plugin-sql-cst` can therefore be used to further control the formatting behavior.
|
|
864
|
+
Formatting embedded SQL language requires the [`prettier-plugin-sql`](https://github.com/un-ts/prettier/tree/master/packages/sql#readme) plugin or the [`prettier-plugin-sql-cst`](https://github.com/nene/prettier-plugin-sql-cst#readme) plugin to be loaded as well. And [options](https://github.com/un-ts/prettier/tree/master/packages/sql#parser-options) supported by `prettier-plugin-sql`, or [options](https://github.com/nene/prettier-plugin-sql-cst?tab=readme-ov-file#configuration) supported by `prettier-plugin-sql-cst` can therefore be used to further control the formatting behavior.
|
|
824
865
|
|
|
825
866
|
Note that `prettier-plugin-sql` supports many different SQL dialects which are specified by the [`language`, `database` or `dialect` option](https://github.com/un-ts/prettier/tree/master/packages/sql#parser-options). And `prettier-plugin-sql-cst` also supports various parsers as shown above. If you want to specify different dialects or parsers for different comments or tags, check [`embeddedOverrides`](#embeddedoverrides-1).
|
|
826
867
|
|
|
827
|
-
####
|
|
868
|
+
#### Svelte
|
|
828
869
|
|
|
829
|
-
##### `
|
|
870
|
+
##### `embeddedSvelteComments`
|
|
830
871
|
|
|
831
872
|
- **Type**: `string[]`
|
|
832
|
-
- **Default**: [`["
|
|
833
|
-
- **Description**: Block comments that
|
|
873
|
+
- **Default**: [`["svelte"]`](./src/embedded/svelte/options.ts)
|
|
874
|
+
- **Description**: Block comments that identify embedded Svelte in template literals. Requires the [`prettier-plugin-svelte`](https://github.com/sveltejs/prettier-plugin-svelte#readme) plugin.
|
|
834
875
|
|
|
835
|
-
##### `
|
|
876
|
+
##### `embeddedSvelteTags`
|
|
836
877
|
|
|
837
878
|
- **Type**: `string[]`
|
|
838
|
-
- **Default**: [`["
|
|
839
|
-
- **Description**: Tags that
|
|
879
|
+
- **Default**: [`["svelte"]`](./src/embedded/svelte/options.ts)
|
|
880
|
+
- **Description**: Tags that identify embedded Svelte in template literals. Requires the [`prettier-plugin-svelte`](https://github.com/sveltejs/prettier-plugin-svelte#readme) plugin.
|
|
840
881
|
|
|
841
|
-
|
|
882
|
+
Formatting embedded Svelte requires the [`prettier-plugin-svelte`](https://github.com/sveltejs/prettier-plugin-svelte#readme) plugin to be installed and loaded. Its options control the embedded formatting behavior.
|
|
842
883
|
|
|
843
|
-
|
|
844
|
-
|
|
884
|
+
Supply the `svelte` compiler alongside the formatter plugin, using versions compatible with the project's Svelte version.
|
|
885
|
+
|
|
886
|
+
#### TOML
|
|
887
|
+
|
|
888
|
+
##### `embeddedTomlComments`
|
|
845
889
|
|
|
846
890
|
- **Type**: `string[]`
|
|
847
891
|
- **Default**: [`["toml"]`](./src/embedded/toml/options.ts)
|
|
848
|
-
- **Description**:
|
|
892
|
+
- **Description**: Block comments that make their subsequent template literals be identified as embedded TOML language. This option requires the [`prettier-plugin-toml`](https://github.com/un-ts/prettier/tree/master/packages/toml#readme) plugin.
|
|
849
893
|
|
|
850
|
-
|
|
894
|
+
##### `embeddedTomlTags`
|
|
851
895
|
|
|
852
|
-
|
|
896
|
+
- **Type**: `string[]`
|
|
897
|
+
- **Default**: [`["toml"]`](./src/embedded/toml/options.ts)
|
|
898
|
+
- **Description**: Tags that make their subsequent template literals be identified as embedded TOML language. This option requires the [`prettier-plugin-toml`](https://github.com/un-ts/prettier/tree/master/packages/toml#readme) plugin.
|
|
853
899
|
|
|
854
900
|
Formatting embedded TOML language requires the [`prettier-plugin-toml`](https://github.com/un-ts/prettier/tree/master/packages/toml#readme) plugin to be loaded as well. And [options](https://github.com/un-ts/prettier/blob/master/packages/toml/src/options.ts) supported by `prettier-plugin-toml` can therefore be used to further control the formatting behavior.
|
|
855
901
|
|
|
@@ -867,26 +913,13 @@ Formatting embedded TOML language requires the [`prettier-plugin-toml`](https://
|
|
|
867
913
|
- **Default**: [`["ts", "tsx", "cts", "mts", "typescript"]`](./src/embedded/ts/options.ts)
|
|
868
914
|
- **Description**: Tags that make their subsequent template literals be identified as embedded TypeScript language.
|
|
869
915
|
|
|
870
|
-
##### ~~`embeddedTsIdentifiers`~~
|
|
871
|
-
|
|
872
|
-
<details>
|
|
873
|
-
<summary>deprecated</summary>
|
|
874
|
-
|
|
875
|
-
- **Type**: `string[]`
|
|
876
|
-
- **Default**: [`["ts", "tsx", "cts", "mts", "typescript"]`](./src/embedded/ts/options.ts)
|
|
877
|
-
- **Description**: Comment or tag identifiers that make their subsequent template literals be identified as embedded TypeScript language.
|
|
878
|
-
|
|
879
|
-
Please use `embeddedTsComments` or `embeddedTsTags`.
|
|
880
|
-
|
|
881
|
-
</details>
|
|
882
|
-
|
|
883
916
|
##### `embeddedTsParser`
|
|
884
917
|
|
|
885
918
|
- **Type**: [`"typescript" | "babel-ts"`](./src/embedded/ts/options.ts)
|
|
886
919
|
- **Default**: [`"typescript"`](./src/embedded/ts/options.ts)
|
|
887
920
|
- **Description**: The parser used to parse the embedded TypeScript language.
|
|
888
921
|
|
|
889
|
-
|
|
922
|
+
Embedded TypeScript uses the parsers and printers included with Prettier.
|
|
890
923
|
|
|
891
924
|
If you want to specify different parsers for different comments or tags, check [`embeddedOverrides`](#embeddedoverrides-1).
|
|
892
925
|
|
|
@@ -896,28 +929,39 @@ If you want to specify different parsers for different comments or tags, check [
|
|
|
896
929
|
|
|
897
930
|
- **Type**: `string[]`
|
|
898
931
|
- **Default**: [`["xml", "opml", "rss", "svg"]`](./src/embedded/xml/options.ts)
|
|
899
|
-
- **Description**: Block comments that make their subsequent template literals be identified as embedded XML language. This option requires the `@prettier/plugin-xml` plugin.
|
|
932
|
+
- **Description**: Block comments that make their subsequent template literals be identified as embedded XML language. This option requires the [`@prettier/plugin-xml`](https://github.com/prettier/plugin-xml#readme) plugin.
|
|
900
933
|
|
|
901
934
|
##### `embeddedXmlTags`
|
|
902
935
|
|
|
903
936
|
- **Type**: `string[]`
|
|
904
937
|
- **Default**: [`["xml", "opml", "rss", "svg"]`](./src/embedded/xml/options.ts)
|
|
905
|
-
- **Description**: Tags that make their subsequent template literals be identified as embedded XML language. This option requires the `@prettier/plugin-xml` plugin.
|
|
938
|
+
- **Description**: Tags that make their subsequent template literals be identified as embedded XML language. This option requires the [`@prettier/plugin-xml`](https://github.com/prettier/plugin-xml#readme) plugin.
|
|
906
939
|
|
|
907
|
-
|
|
940
|
+
Embedded XML uses the parser provided by [`@prettier/plugin-xml`](https://github.com/prettier/plugin-xml#readme), which must be loaded when XML formatting is enabled. Its [options](https://github.com/prettier/plugin-xml#configuration) control the XML formatting behavior.
|
|
908
941
|
|
|
909
|
-
|
|
910
|
-
|
|
942
|
+
#### XQuery
|
|
943
|
+
|
|
944
|
+
##### `embeddedXQueryComments`
|
|
911
945
|
|
|
912
946
|
- **Type**: `string[]`
|
|
913
|
-
- **Default**: [`["
|
|
914
|
-
- **Description**:
|
|
947
|
+
- **Default**: [`["xquery", "xq"]`](./src/embedded/xquery/options.ts)
|
|
948
|
+
- **Description**: Block comments that identify embedded XQuery in template literals. Requires the [`prettier-plugin-xquery`](https://github.com/DrRataplan/prettier-plugin-xquery#readme) plugin.
|
|
915
949
|
|
|
916
|
-
|
|
950
|
+
##### `embeddedXQueryTags`
|
|
917
951
|
|
|
918
|
-
|
|
952
|
+
- **Type**: `string[]`
|
|
953
|
+
- **Default**: [`["xquery", "xq"]`](./src/embedded/xquery/options.ts)
|
|
954
|
+
- **Description**: Tags that identify embedded XQuery in template literals. Requires the [`prettier-plugin-xquery`](https://github.com/DrRataplan/prettier-plugin-xquery#readme) plugin.
|
|
955
|
+
|
|
956
|
+
##### `embeddedXQueryParser`
|
|
957
|
+
|
|
958
|
+
- **Type**: [`"xquery" | "xquery4"`](./src/embedded/xquery/options.ts)
|
|
959
|
+
- **Default**: [`"xquery"`](./src/embedded/xquery/options.ts)
|
|
960
|
+
- **Description**: The parser used to format embedded XQuery.
|
|
919
961
|
|
|
920
|
-
Formatting embedded
|
|
962
|
+
Formatting embedded XQuery requires the [`prettier-plugin-xquery`](https://github.com/DrRataplan/prettier-plugin-xquery#readme) plugin to be installed and loaded. Its options control the embedded formatting behavior.
|
|
963
|
+
|
|
964
|
+
The default `"xquery"` parser formats XQuery 3.1. Select `"xquery4"` for the XQuery 4 syntax supported by the installed formatter version.
|
|
921
965
|
|
|
922
966
|
#### YAML
|
|
923
967
|
|
|
@@ -933,20 +977,7 @@ Formatting embedded XML language requires the [`@prettier/plugin-xml`](https://g
|
|
|
933
977
|
- **Default**: [`["yaml", "yml"]`](./src/embedded/yaml/options.ts)
|
|
934
978
|
- **Description**: Tags that make their subsequent template literals be identified as embedded YAML language.
|
|
935
979
|
|
|
936
|
-
|
|
937
|
-
|
|
938
|
-
<details>
|
|
939
|
-
<summary>deprecated</summary>
|
|
940
|
-
|
|
941
|
-
- **Type**: `string[]`
|
|
942
|
-
- **Default**: [`["yaml", "yml"]`](./src/embedded/yaml/options.ts)
|
|
943
|
-
- **Description**: Comment or tag identifiers that make their subsequent template literals be identified as embedded YAML language.
|
|
944
|
-
|
|
945
|
-
Please use `embeddedYamlComments` or `embeddedYamlTags`.
|
|
946
|
-
|
|
947
|
-
</details>
|
|
948
|
-
|
|
949
|
-
Formatting embedded YAML language doesn't require other plugins and uses the parsers and printers provided by Prettier natively.
|
|
980
|
+
Embedded YAML uses the parsers and printers included with Prettier.
|
|
950
981
|
|
|
951
982
|
</details>
|
|
952
983
|
|
|
@@ -954,32 +985,6 @@ Formatting embedded YAML language doesn't require other plugins and uses the par
|
|
|
954
985
|
|
|
955
986
|
#### Language-Agnostic
|
|
956
987
|
|
|
957
|
-
##### ~~`noEmbeddedIdentificationByComment`~~
|
|
958
|
-
|
|
959
|
-
<details>
|
|
960
|
-
<summary>deprecated</summary>
|
|
961
|
-
|
|
962
|
-
- **Type**: `string[]`
|
|
963
|
-
- **Default**: `[]`
|
|
964
|
-
- **Description**: Turns off `` /* comment */ `...` `` comment-based embedded language identification for the specified identifiers.
|
|
965
|
-
|
|
966
|
-
Please use `embedded<Language>Comments` or `embedded<Language>Tags` to configure each embedded language, and you won't need this option anymore.
|
|
967
|
-
|
|
968
|
-
</details>
|
|
969
|
-
|
|
970
|
-
##### ~~`noEmbeddedIdentificationByTag`~~
|
|
971
|
-
|
|
972
|
-
<details>
|
|
973
|
-
<summary>deprecated</summary>
|
|
974
|
-
|
|
975
|
-
- **Type**: `string[]`
|
|
976
|
-
- **Default**: `[]`
|
|
977
|
-
- **Description**: Turns off `` tag`...` `` tag-based embedded language identification for the specified identifiers.
|
|
978
|
-
|
|
979
|
-
Please use `embedded<Language>Comments` or `embedded<Language>Tags` to configure each embedded language, and you won't need this option anymore.
|
|
980
|
-
|
|
981
|
-
</details>
|
|
982
|
-
|
|
983
988
|
##### `preserveEmbeddedExteriorWhitespaces`
|
|
984
989
|
|
|
985
990
|
- **Type**: `string[]`
|
|
@@ -1002,11 +1007,29 @@ Please use `embedded<Language>Comments` or `embedded<Language>Tags` to configure
|
|
|
1002
1007
|
|
|
1003
1008
|
This option is provided for users to override certain options based on comments or tags. Due to the lack of support for using objects in prettier plugin options (https://github.com/prettier/prettier/issues/14671), it accepts a **stringified** json string, or a file path with an extension of `.json`, `.jsonc`, `.js`, `.cjs`, `.mjs`, `.ts`, `.cts` or `.mts` as its value. If no extension is provided, it will be treated as a `.json`/`.jsonc` file. For relative paths, it will automatically figure out the prettier config location and use that as the base path.
|
|
1004
1009
|
|
|
1005
|
-
|
|
1006
|
-
|
|
1007
|
-
|
|
1010
|
+
TypeScript override files (`.ts`, `.mts` and `.cts`) are loaded with the active runtime's `import()`. Node.js with [native type stripping](https://nodejs.org/api/typescript.html) enabled can load erasable TypeScript, and Bun provides native TypeScript loading. The runtime determines module semantics: `.mts` uses ES modules, `.cts` uses CommonJS, and `.ts` follows the package's module type.
|
|
1011
|
+
|
|
1012
|
+
Consumers can enable a compatible loader through Node.js startup options, such as `node --import tsx node_modules/prettier/bin/prettier.cjs . --write`. Override files are evaluated in workers, which inherit the runtime's startup preloads. Enable synchronous module hooks through a `--import` or `--require` preload so they are available in those workers. When the runtime reports unsupported module loading or TypeScript transformation, the plugin can use the consumer project's optional [`tsx`](https://github.com/privatenumber/tsx#readme) 4.19+ installation as a fallback. This fallback uses Node.js's [`module.register()`](https://nodejs.org/api/module.html#moduleregisterspecifier-parenturl-options) API, introduced in Node.js 18.19 and 20.6. Configuration errors include their original diagnostics.
|
|
1013
|
+
|
|
1014
|
+
The Prettier VS Code extension uses its bundled Node.js runtime; JavaScript override files provide the simplest editor setup.
|
|
1015
|
+
|
|
1016
|
+
Each override module load uses a fresh worker and module cache, so edits to the override file and its imported modules are reflected in subsequent formatting calls. Workers are released after the configuration has been read. Relative paths follow Prettier's configuration discovery and its [`clearConfigCache()`](https://prettier.io/docs/api#prettierclearconfigcache) API.
|
|
1017
|
+
|
|
1018
|
+
The resolved value should be an array of objects. Each object in the array must have 2 fields: `comments` and `options`, or `tags` and `options`. The `options` are considered overrides that will be applied to the global `options` of prettier for those `comments` and `tags` only. It's like the [`overrides`](https://prettier.io/docs/en/configuration.html#configuration-overrides) of `prettier`, but it is comment/tag-based instead of file-based.
|
|
1019
|
+
|
|
1020
|
+
Per-tag overrides refer to the matching entry from `embedded<Language>Tags`, including the pattern string when a regular expression matches. The first matching override applies. For example, this JavaScript configuration gives embedded JavaScript selected by `query` its own quote style:
|
|
1021
|
+
|
|
1022
|
+
```js
|
|
1023
|
+
export default {
|
|
1024
|
+
plugins: ["prettier-plugin-embed"],
|
|
1025
|
+
embeddedEsTags: ["/^query$/"],
|
|
1026
|
+
embeddedOverrides: JSON.stringify([
|
|
1027
|
+
{ tags: ["/^query$/"], options: { singleQuote: true } },
|
|
1028
|
+
]),
|
|
1029
|
+
};
|
|
1030
|
+
```
|
|
1008
1031
|
|
|
1009
|
-
|
|
1032
|
+
Embedded parsers receive the override options. The resulting document is laid out with the surrounding JavaScript or TypeScript document, using the outer Prettier `printWidth`.
|
|
1010
1033
|
|
|
1011
1034
|
In a json file, the root is the array of objects. In a JavaScript/TypeScript file, the array of objects should be a default export, or a named export with the name `embeddedOverrides`.
|
|
1012
1035
|
|
|
@@ -1031,7 +1054,7 @@ An example `.json`/`.jsonc` file is:
|
|
|
1031
1054
|
|
|
1032
1055
|
> [!CAUTION]
|
|
1033
1056
|
>
|
|
1034
|
-
>
|
|
1057
|
+
> `embeddedOverrides` supports options applied during parsing and document generation. Options applied during final document printing, such as `tabWidth`, are configured globally. The [`EmbeddedOverride` interface](https://github.com/Sec-ant/prettier-plugin-embed/blob/main/src/types.ts) lists the supported override options.
|
|
1035
1058
|
|
|
1036
1059
|
### Typed Options
|
|
1037
1060
|
|