prettier-plugin-embed 0.4.9 → 0.4.11
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 +736 -124
- package/dist/embedded/css/options.d.ts +36 -11
- package/dist/embedded/es/options.d.ts +36 -11
- package/dist/embedded/glsl/options.d.ts +36 -11
- package/dist/embedded/graphql/options.d.ts +36 -10
- package/dist/embedded/html/options.d.ts +36 -11
- package/dist/embedded/index.d.ts +2 -2
- package/dist/embedded/ini/options.d.ts +36 -10
- package/dist/embedded/java/options.d.ts +36 -5
- package/dist/embedded/json/options.d.ts +37 -11
- package/dist/embedded/jsonata/options.d.ts +36 -5
- package/dist/embedded/latex/options.d.ts +36 -10
- package/dist/embedded/markdown/options.d.ts +36 -11
- package/dist/embedded/nginx/options.d.ts +36 -5
- package/dist/embedded/noop/options.d.ts +29 -3
- package/dist/embedded/pegjs/options.d.ts +36 -5
- package/dist/embedded/php/options.d.ts +36 -11
- package/dist/embedded/prisma/options.d.ts +36 -5
- package/dist/embedded/properties/options.d.ts +36 -10
- package/dist/embedded/pug/options.d.ts +36 -5
- package/dist/embedded/register.d.ts +2 -2
- package/dist/embedded/ruby/options.d.ts +36 -10
- package/dist/embedded/sh/options.d.ts +36 -10
- package/dist/embedded/sql/options.d.ts +36 -11
- package/dist/embedded/toml/options.d.ts +36 -10
- package/dist/embedded/ts/options.d.ts +37 -12
- package/dist/embedded/types.d.ts +8 -2
- package/dist/embedded/utils.d.ts +3 -1
- package/dist/embedded/xml/options.d.ts +36 -11
- package/dist/embedded/yaml/options.d.ts +36 -10
- package/dist/index.js +1631 -1127
- package/dist/options.d.ts +509 -11
- package/dist/types.d.ts +36 -6
- package/dist/utils.d.ts +136 -5
- package/package.json +6 -6
package/README.md
CHANGED
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
|
|
9
9
|
[](https://github.com/Sec-ant/prettier-plugin-embed) [](https://bundlephobia.com/package/prettier-plugin-embed@latest) [](https://www.jsdelivr.com/package/npm/prettier-plugin-embed)
|
|
10
10
|
|
|
11
|
-
A
|
|
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
14
|
npm i -D prettier-plugin-embed
|
|
@@ -24,7 +24,7 @@ This Prettier plugin (namely [`prettier-plugin-embed`](https://github.com/Sec-an
|
|
|
24
24
|
|
|
25
25
|
### Why?
|
|
26
26
|
|
|
27
|
-
|
|
27
|
+
Prettier has introduced an option for formatting embedded languages, named [`embedded-language-formatting`](https://prettier.io/docs/en/options.html#embedded-language-formatting). However, this option only offers two modes: `auto` and `off`. This limits its functionality, as it does not permit individual formatting adjustments for specific languages. Additionally, it lacks support for customizing which languages require formatting, as well as specifying block comments or tags for embedded language identification. These constraints hinder the feature's overall usability. For in-depth discussions on this matter, see the GitHub issues: [prettier/prettier#4424](https://github.com/prettier/prettier/issues/4424) and [prettier/prettier#5588](https://github.com/prettier/prettier/issues/5588).
|
|
28
28
|
|
|
29
29
|
### How?
|
|
30
30
|
|
|
@@ -34,15 +34,15 @@ By leveraging Prettier's plugin system, this plugin overrides the default [`embe
|
|
|
34
34
|
|
|
35
35
|
- **Support for Additional Languages:** Extend the embedded language formatting capability to include languages such as XML, SQL, PHP, and more.
|
|
36
36
|
|
|
37
|
-
- **Dual Identification Modes:** Identify embedded languages by
|
|
37
|
+
- **Dual Identification Modes:** Identify embedded languages by block comments `` /* comment */ `...` `` or tags `` tag`...` `` preceding the template literals.
|
|
38
38
|
|
|
39
|
-
- **Customizable Language
|
|
39
|
+
- **Customizable Language Comments or Tags:** Customize the comments or tags used for identifying the embedded languages.
|
|
40
40
|
|
|
41
|
-
- **Formatting Opt-out Mechanism:** Offer the capability to deactivate formatting for certain
|
|
41
|
+
- **Formatting Opt-out Mechanism:** Offer the capability to deactivate formatting for certain comments or tags, including the built-in ones (`html`, `css`...) supported by the `embedded-language-formatting` option.
|
|
42
42
|
|
|
43
43
|
- **Configurable Formatting Style:** Provide additional options to tailor the formatting style for embedded languages.
|
|
44
44
|
|
|
45
|
-
- **Strongly Typed API:** Benefit from comprehensive type support for configuring this plugin's options
|
|
45
|
+
- **Strongly Typed API:** Benefit from comprehensive type support for configuring this plugin's options.
|
|
46
46
|
|
|
47
47
|
- **Easy Integration:** Integrate with the existing Prettier setup seamlessly, requiring minimal configuration to get started.
|
|
48
48
|
|
|
@@ -93,17 +93,17 @@ Here're some [quick start config examples](./ConfigExamples.md) to use this plug
|
|
|
93
93
|
|
|
94
94
|
To use this plugin, [`embedded-language-formatting`](https://prettier.io/docs/en/options.html#embedded-language-formatting) option must be set to `auto` (which is the default setting as of now), because this option serves as the main switch for activating embedded language formatting.
|
|
95
95
|
|
|
96
|
-
This plugin does not aim to implement parsers or printers to support every newly added embedded language.
|
|
96
|
+
This plugin does not aim to implement parsers or printers to support every newly added embedded language. Rather, it aims to leverage existing [Prettier plugins](https://prettier.io/docs/en/plugins.html#official-plugins) for those languages, and only adds a thin layer of formatting support when they are embedded in template literals.
|
|
97
97
|
|
|
98
98
|
Therefore, to enable formatting for a specific embedded language, the corresponding Prettier plugin for that language must also be loaded. For example, if you wish to format embedded XML language, you will need to load both this plugin and [`@prettier/plugin-xml`](https://github.com/prettier/plugin-xml). To find out which other plugins are required when using this plugin, please refer to the [Language-Specific Options](#language-specific-options) section below.
|
|
99
99
|
|
|
100
|
-
Embedded languages to be formatted are required to be enclosed in the template literals, and are identified by the preceding [
|
|
100
|
+
Embedded languages to be formatted are required to be enclosed in the template literals, and are identified by the preceding [block comments](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Lexical_grammar#block_comments) `` /* comment */ `...` `` or [tags](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Template_literals#tagged_templates) `` tag`...` ``. This plugin comes pre-configured with a built-in set of comments and tags for identifying various embedded languages. For instance, using comments like `/* xml */` or `/* svg */` or tags like `xml` or `svg` will trigger automatic formatting for the embedded XML language. You can specify an alternative list of comments or tags using the `embeddedXmlComments` option or the `embeddedXmlTags` option, respectively. The naming convention for these options follows the pattern of `embedded<Language>Comments` and `embedded<Language>Tags` for other languages as well. Further details on these options and how to configure them are also available in the [Language-Specific Options](#language-specific-options) section.
|
|
101
101
|
|
|
102
|
-
To exclude certain
|
|
102
|
+
To exclude certain comments or tags from being identified, like the default ones supported by the [`embedded-language-formatting`](https://prettier.io/docs/en/options.html#embedded-language-formatting) option, add them to the list of the `embeddedNoopComments`/`embeddedNoopTags` options. Any matching comments or tags listed in these options will take precedence over other `embedded<Language>Comments` and `embedded<Language>Tags` options, effectively disabling their formatting.
|
|
103
103
|
|
|
104
104
|
> [!IMPORTANT]
|
|
105
105
|
>
|
|
106
|
-
> Until this notice is removed, always specify
|
|
106
|
+
> Until this notice is removed, always specify comments or tags explicitly and do not rely on the built-in defaults, as they may be subject to change.
|
|
107
107
|
|
|
108
108
|
### Language-Specific Options
|
|
109
109
|
|
|
@@ -141,240 +141,810 @@ Click Here to Toggle
|
|
|
141
141
|
|
|
142
142
|
#### NOOP
|
|
143
143
|
|
|
144
|
-
|
|
145
|
-
| :-----------------------: | :--------: | :------------------------------------: | ----------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
146
|
-
| `embeddedNoopIdentifiers` | `string[]` | [`[]`](./src/embedded/noop/options.ts) | Tag or comment identifiers that prevent their subsequent template literals from being identified as embedded languages and thus from being formatted. |
|
|
144
|
+
##### `embeddedNoopComments`
|
|
147
145
|
|
|
148
|
-
|
|
146
|
+
- **Type**: `string[]`
|
|
147
|
+
- **Default**: [`[]`](./src/embedded/noop/options.ts)
|
|
148
|
+
- **Description**: Block comments that prevent their subsequent template literals from being identified as embedded languages and thus from being formatted.
|
|
149
|
+
|
|
150
|
+
##### `embeddedNoopTags`
|
|
151
|
+
|
|
152
|
+
- **Type**: `string[]`
|
|
153
|
+
- **Default**: [`[]`](./src/embedded/noop/options.ts)
|
|
154
|
+
- **Description**: Tags that prevent their subsequent template literals from being identified as embedded languages and thus from being formatted.
|
|
155
|
+
|
|
156
|
+
##### ~~`embeddedNoopIdentifiers`~~
|
|
157
|
+
|
|
158
|
+
<details>
|
|
159
|
+
<summary>deprecated</summary>
|
|
160
|
+
|
|
161
|
+
- **Type**: `string[]`
|
|
162
|
+
- **Default**: [`[]`](./src/embedded/noop/options.ts)
|
|
163
|
+
- **Description**: Comment or tag identifiers that prevent their subsequent template literals from being identified as embedded languages and thus from being formatted.
|
|
164
|
+
|
|
165
|
+
Please use `embeddedNoopComments` or `embeddedNoopTags`.
|
|
166
|
+
|
|
167
|
+
</details>
|
|
168
|
+
|
|
169
|
+
This "language" doesn't require other plugins and can override the native embedded language formatting. It serves as a way to turn off embedded language formatting for the specified language comments or tags.
|
|
149
170
|
|
|
150
171
|
#### CSS
|
|
151
172
|
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
173
|
+
##### `embeddedCssComments`
|
|
174
|
+
|
|
175
|
+
- **Type**: `string[]`
|
|
176
|
+
- **Default**: [`["css"]`](./src/embedded/css/options.ts)
|
|
177
|
+
- **Description**: Block comments that make their subsequent template literals be identified as embedded CSS language.
|
|
178
|
+
|
|
179
|
+
##### `embeddedCssTags`
|
|
180
|
+
|
|
181
|
+
- **Type**: `string[]`
|
|
182
|
+
- **Default**: [`["css"]`](./src/embedded/css/options.ts)
|
|
183
|
+
- **Description**: Tags that make their subsequent template literals be identified as embedded CSS language.
|
|
184
|
+
|
|
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
|
+
##### `embeddedCssParser`
|
|
199
|
+
|
|
200
|
+
- **Type**: [`"css" | "less" | "scss"`](./src/embedded/css/options.ts)
|
|
201
|
+
- **Default**: [`"scss"`](./src/embedded/css/options.ts)
|
|
202
|
+
- **Description**: The parser used to parse the embedded CSS language.
|
|
156
203
|
|
|
157
204
|
Formatting embedded CSS language doesn't require other plugins and uses the parsers and printers provided by Prettier natively.
|
|
158
205
|
|
|
159
|
-
This can override the native formatting bahavior for embedded CSS language. If you want to keep the native behavior, set `
|
|
206
|
+
This can override the native formatting bahavior for embedded CSS language. If you want to keep the native behavior, set `embeddedCssComments` or `embeddedCssTags` to `[]` or other values.
|
|
160
207
|
|
|
161
|
-
If you want to specify different parsers for different
|
|
208
|
+
If you want to specify different parsers for different comments or tags, check [`embeddedOverrides`](#embeddedoverrides-1).
|
|
162
209
|
|
|
163
210
|
#### ES (ECMAScript/JavaScript)
|
|
164
211
|
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
212
|
+
##### `embeddedEsComments`
|
|
213
|
+
|
|
214
|
+
- **Type**: `string[]`
|
|
215
|
+
- **Default**: [`["js", "jsx", "es", "es6", "mjs", "cjs", "pac", "javascript"]`](./src/embedded/es/options.ts)
|
|
216
|
+
- **Description**: Block comments that make their subsequent template literals be identified as embedded ECMAScript/JavaScript language.
|
|
217
|
+
|
|
218
|
+
##### `embeddedEsTags`
|
|
219
|
+
|
|
220
|
+
- **Type**: `string[]`
|
|
221
|
+
- **Default**: [`["js", "jsx", "es", "es6", "mjs", "cjs", "pac", "javascript"]`](./src/embedded/es/options.ts)
|
|
222
|
+
- **Description**: Tags that make their subsequent template literals be identified as embedded ECMAScript/JavaScript language.
|
|
223
|
+
|
|
224
|
+
##### ~~`embeddedEsIdentifiers`~~
|
|
225
|
+
|
|
226
|
+
<details>
|
|
227
|
+
<summary>deprecated</summary>
|
|
228
|
+
|
|
229
|
+
- **Type**: `string[]`
|
|
230
|
+
- **Default**: [`["js", "jsx", "es", "es6", "mjs", "cjs", "pac", "javascript"]`](./src/embedded/es/options.ts)
|
|
231
|
+
- **Description**: Comment or tag identifiers that make their subsequent template literals be identified as embedded ECMAScript/JavaScript language.
|
|
232
|
+
|
|
233
|
+
Please use `embeddedEsComments` or `embeddedEsTags`.
|
|
234
|
+
|
|
235
|
+
</details>
|
|
236
|
+
|
|
237
|
+
##### `embeddedEsParser`
|
|
238
|
+
|
|
239
|
+
- **Type**: [`"babel" | "babel-flow" | "acorn" | "espree" | "flow" | "meriyah"`](./src/embedded/es/options.ts)
|
|
240
|
+
- **Default**: [`"babel"`](./src/embedded/es/options.ts)
|
|
241
|
+
- **Description**: The parser used to parse the embedded ECMASCript/JavaScript language.
|
|
169
242
|
|
|
170
243
|
Formatting embedded ECMAScript/JavaScript language doesn't require other plugins and uses the parsers and printers provided by Prettier natively.
|
|
171
244
|
|
|
172
|
-
If you want to specify different parsers for different
|
|
245
|
+
If you want to specify different parsers for different comments or tags, check [`embeddedOverrides`](#embeddedoverrides-1).
|
|
173
246
|
|
|
174
247
|
#### GLSL
|
|
175
248
|
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
249
|
+
##### `embeddedGlslComments`
|
|
250
|
+
|
|
251
|
+
- **Type**: `string[]`
|
|
252
|
+
- **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.
|
|
254
|
+
|
|
255
|
+
##### `embeddedGlslTags`
|
|
256
|
+
|
|
257
|
+
- **Type**: `string[]`
|
|
258
|
+
- **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.
|
|
260
|
+
|
|
261
|
+
##### ~~`embeddedGlslIdentifiers`~~
|
|
262
|
+
|
|
263
|
+
<details>
|
|
264
|
+
<summary>deprecated</summary>
|
|
265
|
+
|
|
266
|
+
- **Type**: `string[]`
|
|
267
|
+
- **Default**: [`["glsl", "shader"]`](./src/embedded/glsl/options.ts)
|
|
268
|
+
- **Description**: Comment or tag identifiers that make their subsequent template literals be identified as embedded GLSL language. This option requires the `prettier-plugin-glsl` plugin.
|
|
269
|
+
|
|
270
|
+
Please use `embeddedGlslComments` or `embeddedGlslTags`.
|
|
271
|
+
|
|
272
|
+
</details>
|
|
179
273
|
|
|
180
274
|
Formatting embedded GLSL language requires the [`prettier-plugin-glsl`](https://github.com/NaridaL/glsl-language-toolkit/tree/main/packages/prettier-plugin-glsl) plugin to be loaded as well.
|
|
181
275
|
|
|
182
276
|
#### GraphQL
|
|
183
277
|
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
278
|
+
##### `embeddedGraphqlComments`
|
|
279
|
+
|
|
280
|
+
- **Type**: `string[]`
|
|
281
|
+
- **Default**: [`["graphql", "gql"]`](./src/embedded/graphql/options.ts)
|
|
282
|
+
- **Description**: Block comments that make their subsequent template literals be identified as embedded GraphQL language.
|
|
283
|
+
|
|
284
|
+
##### `embeddedGraphqlTags`
|
|
285
|
+
|
|
286
|
+
- **Type**: `string[]`
|
|
287
|
+
- **Default**: [`["graphql", "gql"]`](./src/embedded/graphql/options.ts)
|
|
288
|
+
- **Description**: Tags that make their subsequent template literals be identified as embedded GraphQL language.
|
|
289
|
+
|
|
290
|
+
##### ~~`embeddedGraphqlIdentifiers`~~
|
|
291
|
+
|
|
292
|
+
<details>
|
|
293
|
+
<summary>deprecated</summary>
|
|
294
|
+
|
|
295
|
+
- **Type**: `string[]`
|
|
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.
|
|
298
|
+
|
|
299
|
+
Please use `embeddedGraphqlComments` or `embeddedGraphqlTags`.
|
|
300
|
+
|
|
301
|
+
</details>
|
|
187
302
|
|
|
188
303
|
Formatting embedded GraphQL language doesn't require other plugins and uses the parsers and printers provided by Prettier natively.
|
|
189
304
|
|
|
190
|
-
This can override the native formatting behavior for embedded GraphQL language. If you want to keep the native behavior, set `
|
|
305
|
+
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.
|
|
191
306
|
|
|
192
307
|
#### HTML
|
|
193
308
|
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
309
|
+
##### `embeddedHtmlComments`
|
|
310
|
+
|
|
311
|
+
- **Type**: `string[]`
|
|
312
|
+
- **Default**: [`["html", "xhtml"]`](./src/embedded/html/options.ts)
|
|
313
|
+
- **Description**: Block comments that make their subsequent template literals be identified as embedded HTML language.
|
|
314
|
+
|
|
315
|
+
##### `embeddedHtmlTags`
|
|
316
|
+
|
|
317
|
+
- **Type**: `string[]`
|
|
318
|
+
- **Default**: [`["html", "xhtml"]`](./src/embedded/html/options.ts)
|
|
319
|
+
- **Description**: Tags that make their subsequent template literals be identified as embedded HTML language.
|
|
320
|
+
|
|
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
|
+
##### `embeddedHtmlParser`
|
|
335
|
+
|
|
336
|
+
- **Type**: [`"html" | "vue" | "angular" | "lwc"`](./src/embedded/html/options.ts)
|
|
337
|
+
- **Default**: [`"html"`](./src/embedded/html/options.ts)
|
|
338
|
+
- **Description**: The parser used to parse the embedded HTML language.
|
|
198
339
|
|
|
199
340
|
Formatting embedded HTML language doesn't require other plugins and uses the parsers and printers provided by Prettier natively.
|
|
200
341
|
|
|
201
|
-
This can override the native formatting behavior for embedded HTML language. If you want to keep the native behavior, set `
|
|
342
|
+
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.
|
|
202
343
|
|
|
203
|
-
If you want to specify different parsers for different
|
|
344
|
+
If you want to specify different parsers for different comments or tags, check [`embeddedOverrides`](#embeddedoverrides-1).
|
|
204
345
|
|
|
205
346
|
#### INI
|
|
206
347
|
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
348
|
+
##### `embeddedIniComments`
|
|
349
|
+
|
|
350
|
+
- **Type**: `string[]`
|
|
351
|
+
- **Default**: [`["ini", "cfg", "pro"]`](./src/embedded/ini/options.ts)
|
|
352
|
+
- **Description**: Block comments that make their subsequent template literals be identified as embedded INI language. This option requires the `prettier-plugin-ini` plugin.
|
|
353
|
+
|
|
354
|
+
##### `embeddedIniTags`
|
|
355
|
+
|
|
356
|
+
- **Type**: `string[]`
|
|
357
|
+
- **Default**: [`["ini", "cfg", "pro"]`](./src/embedded/ini/options.ts)
|
|
358
|
+
- **Description**: Tags that make their subsequent template literals be identified as embedded INI language. This option requires the `prettier-plugin-ini` plugin.
|
|
359
|
+
|
|
360
|
+
##### ~~`embeddedIniIdentifiers`~~
|
|
361
|
+
|
|
362
|
+
<details>
|
|
363
|
+
<summary>deprecated</summary>
|
|
364
|
+
|
|
365
|
+
- **Type**: `string[]`
|
|
366
|
+
- **Default**: [`["ini", "cfg", "pro"]`](./src/embedded/ini/options.ts)
|
|
367
|
+
- **Description**: Comment or tag identifiers that make their subsequent template literals be identified as embedded INI language. This option requires the `prettier-plugin-ini` plugin.
|
|
368
|
+
|
|
369
|
+
Please use `embeddedIniComments` or `embeddedIniTags`.
|
|
370
|
+
|
|
371
|
+
</details>
|
|
210
372
|
|
|
211
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.
|
|
212
374
|
|
|
213
375
|
#### Java
|
|
214
376
|
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
377
|
+
##### `embeddedJavaComments`
|
|
378
|
+
|
|
379
|
+
- **Type**: `string[]`
|
|
380
|
+
- **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.
|
|
382
|
+
|
|
383
|
+
##### `embeddedJavaTags`
|
|
384
|
+
|
|
385
|
+
- **Type**: `string[]`
|
|
386
|
+
- **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.
|
|
388
|
+
|
|
389
|
+
##### ~~`embeddedJavaIdentifiers`~~
|
|
390
|
+
|
|
391
|
+
<details>
|
|
392
|
+
<summary>deprecated</summary>
|
|
393
|
+
|
|
394
|
+
- **Type**: `string[]`
|
|
395
|
+
- **Default**: [`["java"]`](./src/embedded/java/options.ts)
|
|
396
|
+
- **Description**: Comment or tag identifiers that make their subsequent template literals be identified as embedded Java language. This option requires the `prettier-plugin-java` plugin.
|
|
397
|
+
|
|
398
|
+
Please use `embeddedJavaComments` or `embeddedJavaTags`.
|
|
399
|
+
|
|
400
|
+
</details>
|
|
218
401
|
|
|
219
402
|
Formatting embedded Java language requires the [`prettier-plugin-java`](https://github.com/jhipster/prettier-java/tree/main/packages/prettier-plugin-java) plugin to be loaded as well. And [options](https://github.com/jhipster/prettier-java/tree/main/packages/prettier-plugin-java#options) supported by `prettier-plugin-java` can therefore be used to further control the formatting behavior.
|
|
220
403
|
|
|
221
404
|
#### JSON
|
|
222
405
|
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
406
|
+
##### `embeddedJsonComments`
|
|
407
|
+
|
|
408
|
+
- **Type**: `string[]`
|
|
409
|
+
- **Default**: [`["json", "jsonl"]`](./src/embedded/json/options.ts)
|
|
410
|
+
- **Description**: Block comments that make their subsequent template literals be identified as embedded JSON language.
|
|
411
|
+
|
|
412
|
+
##### `embeddedJsonTags`
|
|
413
|
+
|
|
414
|
+
- **Type**: `string[]`
|
|
415
|
+
- **Default**: [`["json", "jsonl"]`](./src/embedded/json/options.ts)
|
|
416
|
+
- **Description**: Tags that make their subsequent template literals be identified as embedded JSON language.
|
|
417
|
+
|
|
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
|
+
##### `embeddedJsonParser`
|
|
432
|
+
|
|
433
|
+
- **Type**: [`"json" | "json5" | "jsonc" | "json-stringify"`](./src/embedded/json/options.ts)
|
|
434
|
+
- **Default**: [`"json"`](./src/embedded/json/options.ts)
|
|
435
|
+
- **Description**: The parser used to parse the embedded JSON language.
|
|
227
436
|
|
|
228
437
|
Formatting embedded JSON language doesn't require other plugins and uses the parsers and printers provided by Prettier natively.
|
|
229
438
|
|
|
230
|
-
If you want to specify different parsers for different
|
|
439
|
+
If you want to specify different parsers for different comments or tags, check [`embeddedOverrides`](#embeddedoverrides-1).
|
|
231
440
|
|
|
232
441
|
#### JSONata
|
|
233
442
|
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
443
|
+
##### `embeddedJsonataComments`
|
|
444
|
+
|
|
445
|
+
- **Type**: `string[]`
|
|
446
|
+
- **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.
|
|
448
|
+
|
|
449
|
+
##### `embeddedJsonataTags`
|
|
450
|
+
|
|
451
|
+
- **Type**: `string[]`
|
|
452
|
+
- **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.
|
|
454
|
+
|
|
455
|
+
##### ~~`embeddedJsonataIdentifiers`~~
|
|
456
|
+
|
|
457
|
+
<details>
|
|
458
|
+
<summary>deprecated</summary>
|
|
459
|
+
|
|
460
|
+
- **Type**: `string[]`
|
|
461
|
+
- **Default**: [`["jsonata"]`](./src/embedded/jsonata/options.ts)
|
|
462
|
+
- **Description**: Comment or tag identifiers that make their subsequent template literals be identified as embedded JSONata language. This option requires the `@stedi/prettier-plugin-jsonata` plugin.
|
|
463
|
+
|
|
464
|
+
Please use `embeddedJsonataComments` or `embeddedJsonataTags`.
|
|
465
|
+
|
|
466
|
+
</details>
|
|
237
467
|
|
|
238
468
|
Formatting embedded JSONata language requires the [`@stedi/prettier-plugin-jsonata`](https://github.com/Stedi/prettier-plugin-jsonata) plugin to be loaded as well.
|
|
239
469
|
|
|
240
470
|
#### LaTeX
|
|
241
471
|
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
472
|
+
##### `embeddedLatexComments`
|
|
473
|
+
|
|
474
|
+
- **Type**: `string[]`
|
|
475
|
+
- **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.
|
|
477
|
+
|
|
478
|
+
##### `embeddedLatexTags`
|
|
479
|
+
|
|
480
|
+
- **Type**: `string[]`
|
|
481
|
+
- **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.
|
|
483
|
+
|
|
484
|
+
##### ~~`embeddedLatexIdentifiers`~~
|
|
485
|
+
|
|
486
|
+
<details>
|
|
487
|
+
<summary>deprecated</summary>
|
|
488
|
+
|
|
489
|
+
- **Type**: `string[]`
|
|
490
|
+
- **Default**: [`["latex", "tex", "aux", "cls", "bbl", "bib", "toc", "sty"]`](./src/embedded/latex/options.ts)
|
|
491
|
+
- **Description**: Comment or tag identifiers that make their subsequent template literals be identified as embedded LaTeX language. This option requires the `prettier-plugin-latex` plugin.
|
|
492
|
+
|
|
493
|
+
Please use `embeddedLatexComments` or `embeddedLatexTags`.
|
|
494
|
+
|
|
495
|
+
</details>
|
|
245
496
|
|
|
246
497
|
Formatting embedded LaTeX language requires the [`prettier-plugin-latex`](https://github.com/siefkenj/prettier-plugin-latex) plugin to be loaded as well.
|
|
247
498
|
|
|
248
499
|
#### Markdown
|
|
249
500
|
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
501
|
+
##### `embeddedMarkdownComments`
|
|
502
|
+
|
|
503
|
+
- **Type**: `string[]`
|
|
504
|
+
- **Default**: [`["md", "markdown"]`](./src/embedded/markdown/options.ts)
|
|
505
|
+
- **Description**: Block comments that make their subsequent template literals be identified as embedded Markdown language.
|
|
506
|
+
|
|
507
|
+
##### `embeddedMarkdownTags`
|
|
508
|
+
|
|
509
|
+
- **Type**: `string[]`
|
|
510
|
+
- **Default**: [`["md", "markdown"]`](./src/embedded/markdown/options.ts)
|
|
511
|
+
- **Description**: Tags that make their subsequent template literals be identified as embedded Markdown language.
|
|
512
|
+
|
|
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
|
+
##### `embeddedMarkdownParser`
|
|
527
|
+
|
|
528
|
+
- **Type**: [`"markdown" | "mdx" | "remark"`](./src/embedded/markdown/options.ts)
|
|
529
|
+
- **Default**: [`"markdown"`](./src/embedded/markdown/options.ts)
|
|
530
|
+
- **Description**: The parser used to parse the embedded Markdown language.
|
|
254
531
|
|
|
255
532
|
Formatting embedded Markdown language doesn't require other plugins and uses the parsers and printers provided by Prettier natively.
|
|
256
533
|
|
|
257
|
-
This can override the native formatting for embedded Markdown language. If you want to keep the native behavior, set `
|
|
534
|
+
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.
|
|
258
535
|
|
|
259
|
-
If you want to specify different parsers for different
|
|
536
|
+
If you want to specify different parsers for different comments or tags, check [`embeddedOverrides`](#embeddedoverrides-1).
|
|
260
537
|
|
|
261
538
|
The `remark` parser is [an alias of the `markdown` parser](https://github.com/prettier/prettier/blob/ed23dacc9e655c3876971b30859497b17ff2cf9f/src/language-markdown/parser-markdown.js#L57).
|
|
262
539
|
|
|
263
540
|
#### NGINX
|
|
264
541
|
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
542
|
+
##### `embeddedNginxComments`
|
|
543
|
+
|
|
544
|
+
- **Type**: `string[]`
|
|
545
|
+
- **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.
|
|
547
|
+
|
|
548
|
+
##### `embeddedNginxTags`
|
|
549
|
+
|
|
550
|
+
- **Type**: `string[]`
|
|
551
|
+
- **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.
|
|
553
|
+
|
|
554
|
+
##### ~~`embeddedNginxIdentifiers`~~
|
|
555
|
+
|
|
556
|
+
<details>
|
|
557
|
+
<summary>deprecated</summary>
|
|
558
|
+
|
|
559
|
+
- **Type**: `string[]`
|
|
560
|
+
- **Default**: [`["nginx"]`](./src/embedded/nginx/options.ts)
|
|
561
|
+
- **Description**: Comment or tag identifiers that make their subsequent template literals be identified as embedded NGINX language. This option requires the `prettier-plugin-nginx` plugin.
|
|
562
|
+
|
|
563
|
+
Please use `embeddedNginxComments` or `embeddedNginxTags`.
|
|
564
|
+
|
|
565
|
+
</details>
|
|
268
566
|
|
|
269
567
|
Formatting embedded NGINX language requires the [`prettier-plugin-nginx`](https://github.com/jxddk/prettier-plugin-nginx) 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.
|
|
270
568
|
|
|
271
569
|
#### Pegjs
|
|
272
570
|
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
571
|
+
##### `embeddedPegjsComments`
|
|
572
|
+
|
|
573
|
+
- **Type**: `string[]`
|
|
574
|
+
- **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.
|
|
576
|
+
|
|
577
|
+
##### `embeddedPegjsTags`
|
|
578
|
+
|
|
579
|
+
- **Type**: `string[]`
|
|
580
|
+
- **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`.
|
|
593
|
+
|
|
594
|
+
</details>
|
|
276
595
|
|
|
277
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.
|
|
278
597
|
|
|
279
|
-
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
|
|
598
|
+
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).
|
|
280
599
|
|
|
281
600
|
#### PHP
|
|
282
601
|
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
602
|
+
##### `embeddedPhpComments`
|
|
603
|
+
|
|
604
|
+
- **Type**: `string[]`
|
|
605
|
+
- **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.
|
|
607
|
+
|
|
608
|
+
##### `embeddedPhpTags`
|
|
609
|
+
|
|
610
|
+
- **Type**: `string[]`
|
|
611
|
+
- **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.
|
|
613
|
+
|
|
614
|
+
##### ~~`embeddedPhpIdentifiers`~~
|
|
615
|
+
|
|
616
|
+
<details>
|
|
617
|
+
<summary>deprecated</summary>
|
|
618
|
+
|
|
619
|
+
- **Type**: `string[]`
|
|
620
|
+
- **Default**: [`["php", "php5"]`](./src/embedded/php/options.ts)
|
|
621
|
+
- **Description**: Comment or tag identifiers that make their subsequent template literals be identified as embedded PHP language. This option requires the `@prettier/plugin-php` plugin.
|
|
622
|
+
|
|
623
|
+
Please use `embeddedPhpComments` or `embeddedPhpTags`.
|
|
624
|
+
|
|
625
|
+
</details>
|
|
286
626
|
|
|
287
627
|
Formatting embedded PHP language requires the [`@prettier/plugin-php`](https://github.com/prettier/plugin-php) 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.
|
|
288
628
|
|
|
289
629
|
#### Prisma
|
|
290
630
|
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
631
|
+
##### `embeddedPrismaComments`
|
|
632
|
+
|
|
633
|
+
- **Type**: `string[]`
|
|
634
|
+
- **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.
|
|
636
|
+
|
|
637
|
+
##### `embeddedPrismaTags`
|
|
638
|
+
|
|
639
|
+
- **Type**: `string[]`
|
|
640
|
+
- **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.
|
|
642
|
+
|
|
643
|
+
##### ~~`embeddedPrismaIdentifiers`~~
|
|
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>
|
|
294
655
|
|
|
295
656
|
Formatting embedded Prisma language requires the [`prettier-plugin-prisma`](https://github.com/avocadowastaken/prettier-plugin-prisma) plugin to be loaded as well.
|
|
296
657
|
|
|
297
658
|
#### Properties
|
|
298
659
|
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
660
|
+
##### `embeddedPropertiesComments`
|
|
661
|
+
|
|
662
|
+
- **Type**: `string[]`
|
|
663
|
+
- **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.
|
|
665
|
+
|
|
666
|
+
##### `embeddedPropertiesTags`
|
|
667
|
+
|
|
668
|
+
- **Type**: `string[]`
|
|
669
|
+
- **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`~~
|
|
673
|
+
|
|
674
|
+
<details>
|
|
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>
|
|
302
684
|
|
|
303
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.
|
|
304
686
|
|
|
305
687
|
#### Pug
|
|
306
688
|
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
689
|
+
##### `embeddedPugComments`
|
|
690
|
+
|
|
691
|
+
- **Type**: `string[]`
|
|
692
|
+
- **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.
|
|
694
|
+
|
|
695
|
+
##### `embeddedPugTags`
|
|
696
|
+
|
|
697
|
+
- **Type**: `string[]`
|
|
698
|
+
- **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`~~
|
|
702
|
+
|
|
703
|
+
<details>
|
|
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>
|
|
310
713
|
|
|
311
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.
|
|
312
715
|
|
|
313
716
|
#### Ruby
|
|
314
717
|
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
718
|
+
##### `embeddedRubyComments`
|
|
719
|
+
|
|
720
|
+
- **Type**: `string[]`
|
|
721
|
+
- **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.
|
|
723
|
+
|
|
724
|
+
##### `embeddedRubyTags`
|
|
725
|
+
|
|
726
|
+
- **Type**: `string[]`
|
|
727
|
+
- **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>
|
|
742
|
+
|
|
743
|
+
##### `embeddedRubyParser`
|
|
744
|
+
|
|
745
|
+
- **Type**: [`"ruby" | "rbs" | "haml"`](./src/embedded/ruby/options.ts)
|
|
746
|
+
- **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.
|
|
319
748
|
|
|
320
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.
|
|
321
750
|
|
|
322
|
-
If you want to specify different parsers for different
|
|
751
|
+
If you want to specify different parsers for different comments or tags, check [`embeddedOverrides`](#embeddedoverrides-1).
|
|
323
752
|
|
|
324
753
|
#### Sh (Shell)
|
|
325
754
|
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
755
|
+
##### `embeddedShComments`
|
|
756
|
+
|
|
757
|
+
- **Type**: `string[]`
|
|
758
|
+
- **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.
|
|
760
|
+
|
|
761
|
+
##### `embeddedShTags`
|
|
762
|
+
|
|
763
|
+
- **Type**: `string[]`
|
|
764
|
+
- **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.
|
|
766
|
+
|
|
767
|
+
##### ~~`embeddedShIdentifiers`~~
|
|
768
|
+
|
|
769
|
+
<details>
|
|
770
|
+
<summary>deprecated</summary>
|
|
771
|
+
|
|
772
|
+
- **Type**: `string[]`
|
|
773
|
+
- **Default**: [`["sh"]`](./src/embedded/sh/options.ts)
|
|
774
|
+
- **Description**: Comment or tag identifiers that make their subsequent template literals be identified as embedded Shell language. This option requires the `prettier-plugin-sh` plugin.
|
|
775
|
+
|
|
776
|
+
Please use `embeddedShComments` or `embeddedShTags`.
|
|
777
|
+
|
|
778
|
+
</details>
|
|
329
779
|
|
|
330
780
|
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.
|
|
331
781
|
|
|
332
|
-
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
|
|
782
|
+
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).
|
|
333
783
|
|
|
334
784
|
#### SQL
|
|
335
785
|
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
786
|
+
##### `embeddedSqlComments`
|
|
787
|
+
|
|
788
|
+
- **Type**: `string[]`
|
|
789
|
+
- **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.
|
|
791
|
+
|
|
792
|
+
##### `embeddedSqlTags`
|
|
793
|
+
|
|
794
|
+
- **Type**: `string[]`
|
|
795
|
+
- **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>
|
|
810
|
+
|
|
811
|
+
##### `embeddedSqlPlugin`
|
|
812
|
+
|
|
813
|
+
- **Type**: [`"prettier-plugin-sql" | "prettier-plugin-sql-cst"`](./src/embedded/sql/options.ts)
|
|
814
|
+
- **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.
|
|
816
|
+
|
|
817
|
+
##### `embeddedSqlParser`
|
|
818
|
+
|
|
819
|
+
- **Type**: [`"sqlite" | "bigquery" | "mysql" | "mariadb" | "postgresql"` ](./src/embedded/sql/options.ts)
|
|
820
|
+
- **Default**: [`"sqlite"`](./src/embedded/sql/options.ts)
|
|
821
|
+
- **Description**: Specify the embedded SQL language parser. This option is only needed with the `prettier-plugin-sql-cst` plugin.
|
|
341
822
|
|
|
342
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.
|
|
343
824
|
|
|
344
|
-
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
|
|
825
|
+
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).
|
|
345
826
|
|
|
346
827
|
#### TOML
|
|
347
828
|
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
829
|
+
##### `embeddedTomlComments`
|
|
830
|
+
|
|
831
|
+
- **Type**: `string[]`
|
|
832
|
+
- **Default**: [`["toml"]`](./src/embedded/toml/options.ts)
|
|
833
|
+
- **Description**: Block comments that make their subsequent template literals be identified as embedded TOML language. This option requires the `prettier-plugin-toml` plugin.
|
|
834
|
+
|
|
835
|
+
##### `embeddedTomlTags`
|
|
836
|
+
|
|
837
|
+
- **Type**: `string[]`
|
|
838
|
+
- **Default**: [`["toml"]`](./src/embedded/toml/options.ts)
|
|
839
|
+
- **Description**: Tags that make their subsequent template literals be identified as embedded TOML language. This option requires the `prettier-plugin-toml` plugin.
|
|
840
|
+
|
|
841
|
+
##### ~~`embeddedTomlIdentifiers`~~
|
|
842
|
+
|
|
843
|
+
<details>
|
|
844
|
+
<summary>deprecated</summary>
|
|
845
|
+
|
|
846
|
+
- **Type**: `string[]`
|
|
847
|
+
- **Default**: [`["toml"]`](./src/embedded/toml/options.ts)
|
|
848
|
+
- **Description**: Comment or tag identifiers that make their subsequent template literals be identified as embedded TOML language. This option requires the `prettier-plugin-toml` plugin.
|
|
849
|
+
|
|
850
|
+
Please use `embeddedTomlComments` or `embeddedTomlTags`.
|
|
851
|
+
|
|
852
|
+
</details>
|
|
351
853
|
|
|
352
854
|
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.
|
|
353
855
|
|
|
354
856
|
#### TS (TypeScript)
|
|
355
857
|
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
858
|
+
##### `embeddedTsComments`
|
|
859
|
+
|
|
860
|
+
- **Type**: `string[]`
|
|
861
|
+
- **Default**: [`["ts", "tsx", "cts", "mts", "typescript"]`](./src/embedded/ts/options.ts)
|
|
862
|
+
- **Description**: Block comments that make their subsequent template literals be identified as embedded TypeScript language.
|
|
863
|
+
|
|
864
|
+
##### `embeddedTsTags`
|
|
865
|
+
|
|
866
|
+
- **Type**: `string[]`
|
|
867
|
+
- **Default**: [`["ts", "tsx", "cts", "mts", "typescript"]`](./src/embedded/ts/options.ts)
|
|
868
|
+
- **Description**: Tags that make their subsequent template literals be identified as embedded TypeScript language.
|
|
869
|
+
|
|
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
|
+
##### `embeddedTsParser`
|
|
884
|
+
|
|
885
|
+
- **Type**: [`"typescript" | "babel-ts"`](./src/embedded/ts/options.ts)
|
|
886
|
+
- **Default**: [`"typescript"`](./src/embedded/ts/options.ts)
|
|
887
|
+
- **Description**: The parser used to parse the embedded TypeScript language.
|
|
360
888
|
|
|
361
889
|
Formatting embedded TypeScript language doesn't require other plugins and uses the parsers and printers provided by Prettier natively.
|
|
362
890
|
|
|
363
|
-
If you want to specify different parsers for different
|
|
891
|
+
If you want to specify different parsers for different comments or tags, check [`embeddedOverrides`](#embeddedoverrides-1).
|
|
364
892
|
|
|
365
893
|
#### XML
|
|
366
894
|
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
895
|
+
##### `embeddedXmlComments`
|
|
896
|
+
|
|
897
|
+
- **Type**: `string[]`
|
|
898
|
+
- **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.
|
|
900
|
+
|
|
901
|
+
##### `embeddedXmlTags`
|
|
902
|
+
|
|
903
|
+
- **Type**: `string[]`
|
|
904
|
+
- **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.
|
|
906
|
+
|
|
907
|
+
##### ~~`embeddedXmlIdentifiers`~~
|
|
908
|
+
|
|
909
|
+
<details>
|
|
910
|
+
<summary>deprecated</summary>
|
|
911
|
+
|
|
912
|
+
- **Type**: `string[]`
|
|
913
|
+
- **Default**: [`["xml", "opml", "rss", "svg"]`](./src/embedded/xml/options.ts)
|
|
914
|
+
- **Description**: Comment or tag identifiers that make their subsequent template literals be identified as embedded XML language. This option requires the `@prettier/plugin-xml` plugin.
|
|
915
|
+
|
|
916
|
+
Please use `embeddedXmlComments` or `embeddedXmlTags`.
|
|
917
|
+
|
|
918
|
+
</details>
|
|
370
919
|
|
|
371
920
|
Formatting embedded XML language requires the [`@prettier/plugin-xml`](https://github.com/prettier/plugin-xml) plugin to be loaded as well. And [options](https://github.com/prettier/plugin-xml#configuration) supported by `@prettier/plugin-xml` can therefore be used to further control the formatting behavior.
|
|
372
921
|
|
|
373
922
|
#### YAML
|
|
374
923
|
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
924
|
+
##### `embeddedYamlComments`
|
|
925
|
+
|
|
926
|
+
- **Type**: `string[]`
|
|
927
|
+
- **Default**: [`["yaml", "yml"]`](./src/embedded/yaml/options.ts)
|
|
928
|
+
- **Description**: Block comments that make their subsequent template literals be identified as embedded YAML language.
|
|
929
|
+
|
|
930
|
+
##### `embeddedYamlTags`
|
|
931
|
+
|
|
932
|
+
- **Type**: `string[]`
|
|
933
|
+
- **Default**: [`["yaml", "yml"]`](./src/embedded/yaml/options.ts)
|
|
934
|
+
- **Description**: Tags that make their subsequent template literals be identified as embedded YAML language.
|
|
935
|
+
|
|
936
|
+
##### ~~`embeddedYamlIdentifiers`~~
|
|
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>
|
|
378
948
|
|
|
379
949
|
Formatting embedded YAML language doesn't require other plugins and uses the parsers and printers provided by Prettier natively.
|
|
380
950
|
|
|
@@ -382,34 +952,76 @@ Formatting embedded YAML language doesn't require other plugins and uses the par
|
|
|
382
952
|
|
|
383
953
|
### Language-Agnostic Options
|
|
384
954
|
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
955
|
+
#### Language-Agnostic
|
|
956
|
+
|
|
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
|
+
##### `preserveEmbeddedExteriorWhitespaces`
|
|
984
|
+
|
|
985
|
+
- **Type**: `string[]`
|
|
986
|
+
- **Default**: `[]`
|
|
987
|
+
- **Description**: Preserves leading and trailing whitespaces in the formatting results for the specified comments or tags.
|
|
988
|
+
|
|
989
|
+
##### `noEmbeddedMultiLineIndentation`
|
|
990
|
+
|
|
991
|
+
- **Type**: `string[]`
|
|
992
|
+
- **Default**: `[]`
|
|
993
|
+
- **Description**: Turns off auto indentation in the formatting results for the specified comments or tags when they are formatted to span multi lines.
|
|
994
|
+
|
|
995
|
+
##### `embeddedOverrides`
|
|
996
|
+
|
|
997
|
+
- **Type**: `string`
|
|
998
|
+
- **Default**: `undefined`
|
|
999
|
+
- **Description**: Option overrides for the specified comments or tags. It should either be a stringified JSON or an absolute filepath to the option overrides file. See [below](#embeddedoverrides-1) for a detailed explanation.
|
|
392
1000
|
|
|
393
1001
|
#### `embeddedOverrides`
|
|
394
1002
|
|
|
395
|
-
This option is provided for users to override certain options based on
|
|
1003
|
+
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
|
+
|
|
1005
|
+
> [!NOTE]
|
|
1006
|
+
>
|
|
1007
|
+
> The support for using `.ts`, `.mts` or `.cts` files for `embeddedOverrides` requires a minimal `node` version of [18.19.0](https://nodejs.org/en/blog/release/v18.19.0#esm-and-customization-hook-changes), and [`tsx`](https://github.com/privatenumber/tsx) as a dependency in your project. And it currently doesn't work with the Prettier VSCode extension.
|
|
396
1008
|
|
|
397
|
-
The resolved value should be an array of objects. Each object in the array must have 2 fields: `
|
|
1009
|
+
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 considerred 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.
|
|
398
1010
|
|
|
399
|
-
In a json file, the root is the array of objects. In a JavaScript file, the array of objects should be a default export, or a named export with the name `embeddedOverrides`.
|
|
1011
|
+
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`.
|
|
400
1012
|
|
|
401
|
-
An example `.json` file is:
|
|
1013
|
+
An example `.json`/`.jsonc` file is:
|
|
402
1014
|
|
|
403
1015
|
```json
|
|
404
1016
|
[
|
|
405
1017
|
{
|
|
406
|
-
"
|
|
1018
|
+
"comments": ["sql"],
|
|
407
1019
|
"options": {
|
|
408
1020
|
"keywordCase": "lower"
|
|
409
1021
|
}
|
|
410
1022
|
},
|
|
411
1023
|
{
|
|
412
|
-
"
|
|
1024
|
+
"tags": ["mysql"],
|
|
413
1025
|
"options": {
|
|
414
1026
|
"keywordCase": "upper"
|
|
415
1027
|
}
|
|
@@ -419,7 +1031,7 @@ An example `.json` file is:
|
|
|
419
1031
|
|
|
420
1032
|
> [!CAUTION]
|
|
421
1033
|
>
|
|
422
|
-
> Please note that not every option is supported to override. That largely depends on at which phase those options will kick in and take effect. For example, you can't override `tabWidth` in `embeddedOverrides` because this option is used in the [`printDocToString`](https://github.com/prettier/prettier/blob/7aecca5d6473d73f562ca3af874831315f8f2581/src/document/printer.js#L302) phase, where `prettier-plugin-embed` cannot override this option for only a set of specified
|
|
1034
|
+
> Please note that not every option is supported to override. That largely depends on at which phase those options will kick in and take effect. For example, you can't override `tabWidth` in `embeddedOverrides` because this option is used in the [`printDocToString`](https://github.com/prettier/prettier/blob/7aecca5d6473d73f562ca3af874831315f8f2581/src/document/printer.js#L302) phase, where `prettier-plugin-embed` cannot override this option for only a set of specified comments or tags. To find the list of unsupported options, please check the interface definition of `EmbeddedOverride` in the [source code](https://github.com/Sec-ant/prettier-plugin-embed/blob/main/src/types.ts).
|
|
423
1035
|
|
|
424
1036
|
### Typed Options
|
|
425
1037
|
|
|
@@ -474,7 +1086,7 @@ There're several ways to use the typed options provided by this plugin. Taking t
|
|
|
474
1086
|
* @type {import("prettier-plugin-embed").PluginEmbedOptions}
|
|
475
1087
|
*/
|
|
476
1088
|
const pluginEmbedOptions = {
|
|
477
|
-
|
|
1089
|
+
embeddedSqlTags: ["sql"],
|
|
478
1090
|
};
|
|
479
1091
|
|
|
480
1092
|
/**
|