prettier-plugin-embed 0.4.6 → 0.4.7
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 +15 -7
- package/dist/embedded/css/options.d.ts +14 -0
- package/dist/embedded/markdown/options.d.ts +14 -0
- package/dist/embedded/register.d.ts +6 -6
- package/dist/index.js +572 -552
- package/dist/options.d.ts +20 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -139,18 +139,21 @@ Click Here to Toggle
|
|
|
139
139
|
| :-----------------------: | :--------: | :------------------------------------: | ----------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
140
140
|
| `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. |
|
|
141
141
|
|
|
142
|
-
This option 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
|
|
142
|
+
This option 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 identifiers.
|
|
143
143
|
|
|
144
144
|
#### CSS
|
|
145
145
|
|
|
146
|
-
| Option |
|
|
147
|
-
| :----------------------: |
|
|
148
|
-
| `embeddedCssIdentifiers` |
|
|
146
|
+
| Option | Type | Default | Description |
|
|
147
|
+
| :----------------------: | :----------------------------------------------------------: | :----------------------------------------: | --------------------------------------------------------------------------------------------------------------- |
|
|
148
|
+
| `embeddedCssIdentifiers` | `string[]` | [`["css"]`](./src/embedded/css/options.ts) | Tag or comment identifiers that make their subsequent template literals be identified as embedded CSS language. |
|
|
149
|
+
| `embeddedCssParser` | [`"css" \| "less"\| "scss"`](./src/embedded/css/options.ts) | [`"scss"`](./src/embedded/css/options.ts) | The parser used to parse the embedded CSS language. |
|
|
149
150
|
|
|
150
151
|
Formatting embedded CSS language doesn't require other plugins and uses the parsers and printers provided by Prettier natively.
|
|
151
152
|
|
|
152
153
|
This can override the native formatting bahavior for embedded CSS language. If you want to keep the native behavior, set `embeddedCssIdentifiers` to `[]` or other identifiers.
|
|
153
154
|
|
|
155
|
+
If you want to specify different parsers for different identifiers, check [`embeddedOverrides`](#embeddedoverrides).
|
|
156
|
+
|
|
154
157
|
#### ES (ECMAScript/JavaScript)
|
|
155
158
|
|
|
156
159
|
| Option | Type | Default | Description |
|
|
@@ -222,14 +225,19 @@ Formatting embedded LaTeX language requires the [`prettier-plugin-latex`](https:
|
|
|
222
225
|
|
|
223
226
|
#### Markdown
|
|
224
227
|
|
|
225
|
-
| Option |
|
|
226
|
-
| :---------------------------: |
|
|
227
|
-
| `embeddedMarkdownIdentifiers` |
|
|
228
|
+
| Option | Type | Default | Description |
|
|
229
|
+
| :---------------------------: | :---------------------------------------------------------------------: | :--------------------------------------------------------: | -------------------------------------------------------------------------------------------------------------------- |
|
|
230
|
+
| `embeddedMarkdownIdentifiers` | `string[]` | [`["md", "markdown"]`](./src/embedded/markdown/options.ts) | Tag or comment identifiers that make their subsequent template literals be identified as embedded Markdown language. |
|
|
231
|
+
| `embeddedMarkdownParser` | [`"markdown" \| "mdx"\| "remark"`](./src/embedded/markdown/options.ts) | [`"markdown"`](./src/embedded/markdown/options.ts) | The parser used to parse the embedded Markdown language. |
|
|
228
232
|
|
|
229
233
|
Formatting embedded Markdown language doesn't require other plugins and uses the parsers and printers provided by Prettier natively.
|
|
230
234
|
|
|
231
235
|
This can override the native formatting for embedded Markdown language. If you want to keep the native behavior, set `embeddedMarkdownIdentifiers` to `[]` or other identifiers.
|
|
232
236
|
|
|
237
|
+
If you want to specify different parsers for different identifiers, check [`embeddedOverrides`](#embeddedoverrides).
|
|
238
|
+
|
|
239
|
+
The `remark` parser is [an alias of the `markdown` parser](https://github.com/prettier/prettier/blob/ed23dacc9e655c3876971b30859497b17ff2cf9f/src/language-markdown/parser-markdown.js#L57).
|
|
240
|
+
|
|
233
241
|
#### PHP
|
|
234
242
|
|
|
235
243
|
| Option | Type | Default | Description |
|
|
@@ -8,7 +8,10 @@ import { type AutocompleteStringList, type StringListToInterfaceKey } from "../u
|
|
|
8
8
|
declare const DEFAULT_IDENTIFIERS: readonly ["css"];
|
|
9
9
|
type Identifiers = AutocompleteStringList<typeof DEFAULT_IDENTIFIERS>;
|
|
10
10
|
type DefaultIdentifiersHolder = StringListToInterfaceKey<typeof DEFAULT_IDENTIFIERS>;
|
|
11
|
+
declare const CSS_PARSERS: readonly ["css", "less", "scss"];
|
|
12
|
+
type CssParser = (typeof CSS_PARSERS)[number];
|
|
11
13
|
declare const EMBEDDED_LANGUAGE_IDENTIFIERS: "embeddedCssIdentifiers";
|
|
14
|
+
declare const EMBEDDED_LANGUAGE_PARSER: "embeddedCssParser";
|
|
12
15
|
export interface PrettierPluginDepsOptions {
|
|
13
16
|
}
|
|
14
17
|
export declare const options: {
|
|
@@ -21,6 +24,16 @@ export declare const options: {
|
|
|
21
24
|
}];
|
|
22
25
|
readonly description: "Tag or comment identifiers that make their subsequent template literals be identified as embedded CSS language.";
|
|
23
26
|
};
|
|
27
|
+
readonly embeddedCssParser: {
|
|
28
|
+
category: string;
|
|
29
|
+
type: "choice";
|
|
30
|
+
default: "scss";
|
|
31
|
+
description: string;
|
|
32
|
+
choices: {
|
|
33
|
+
value: "css" | "less" | "scss";
|
|
34
|
+
description: string;
|
|
35
|
+
}[];
|
|
36
|
+
};
|
|
24
37
|
};
|
|
25
38
|
type Options = typeof options;
|
|
26
39
|
declare module "../types.js" {
|
|
@@ -30,6 +43,7 @@ declare module "../types.js" {
|
|
|
30
43
|
}
|
|
31
44
|
interface PrettierPluginEmbedOptions {
|
|
32
45
|
[EMBEDDED_LANGUAGE_IDENTIFIERS]?: Identifiers;
|
|
46
|
+
[EMBEDDED_LANGUAGE_PARSER]?: CssParser;
|
|
33
47
|
}
|
|
34
48
|
}
|
|
35
49
|
declare module "prettier" {
|
|
@@ -8,7 +8,10 @@ import { type AutocompleteStringList, type StringListToInterfaceKey } from "../u
|
|
|
8
8
|
declare const DEFAULT_IDENTIFIERS: readonly ["md", "markdown"];
|
|
9
9
|
type Identifiers = AutocompleteStringList<typeof DEFAULT_IDENTIFIERS>;
|
|
10
10
|
type DefaultIdentifiersHolder = StringListToInterfaceKey<typeof DEFAULT_IDENTIFIERS>;
|
|
11
|
+
declare const MARKDOWN_PARSERS: readonly ["markdown", "mdx", "remark"];
|
|
12
|
+
type MarkdownParser = (typeof MARKDOWN_PARSERS)[number];
|
|
11
13
|
declare const EMBEDDED_LANGUAGE_IDENTIFIERS: "embeddedMarkdownIdentifiers";
|
|
14
|
+
declare const EMBEDDED_LANGUAGE_PARSER: "embeddedMarkdownParser";
|
|
12
15
|
export interface PrettierPluginDepsOptions {
|
|
13
16
|
__inJsTemplate?: boolean;
|
|
14
17
|
}
|
|
@@ -22,6 +25,16 @@ export declare const options: {
|
|
|
22
25
|
}];
|
|
23
26
|
readonly description: "Tag or comment identifiers that make their subsequent template literals be identified as embedded Markdown language.";
|
|
24
27
|
};
|
|
28
|
+
readonly embeddedMarkdownParser: {
|
|
29
|
+
category: string;
|
|
30
|
+
type: "choice";
|
|
31
|
+
default: "markdown";
|
|
32
|
+
description: string;
|
|
33
|
+
choices: {
|
|
34
|
+
value: "markdown" | "mdx" | "remark";
|
|
35
|
+
description: string;
|
|
36
|
+
}[];
|
|
37
|
+
};
|
|
25
38
|
};
|
|
26
39
|
type Options = typeof options;
|
|
27
40
|
declare module "../types.js" {
|
|
@@ -31,6 +44,7 @@ declare module "../types.js" {
|
|
|
31
44
|
}
|
|
32
45
|
interface PrettierPluginEmbedOptions {
|
|
33
46
|
[EMBEDDED_LANGUAGE_IDENTIFIERS]?: Identifiers;
|
|
47
|
+
[EMBEDDED_LANGUAGE_PARSER]?: MarkdownParser;
|
|
34
48
|
}
|
|
35
49
|
}
|
|
36
50
|
declare module "prettier" {
|
|
@@ -5,16 +5,16 @@ export declare const embeddedEmbedders: EmbeddedEmbedders;
|
|
|
5
5
|
export declare const embeddedOptions: EmbeddedOptions;
|
|
6
6
|
import * as __glob__0_0 from "./css/index.js";
|
|
7
7
|
import * as __glob__0_1 from "./es/index.js";
|
|
8
|
-
import * as __glob__0_2 from "./
|
|
9
|
-
import * as __glob__0_3 from "./
|
|
10
|
-
import * as __glob__0_4 from "./
|
|
8
|
+
import * as __glob__0_2 from "./html/index.js";
|
|
9
|
+
import * as __glob__0_3 from "./glsl/index.js";
|
|
10
|
+
import * as __glob__0_4 from "./graphql/index.js";
|
|
11
11
|
import * as __glob__0_5 from "./ini/index.js";
|
|
12
12
|
import * as __glob__0_6 from "./json/index.js";
|
|
13
13
|
import * as __glob__0_7 from "./latex/index.js";
|
|
14
|
-
import * as __glob__0_8 from "./
|
|
15
|
-
import * as __glob__0_9 from "./
|
|
14
|
+
import * as __glob__0_8 from "./markdown/index.js";
|
|
15
|
+
import * as __glob__0_9 from "./noop/index.js";
|
|
16
16
|
import * as __glob__0_10 from "./properties/index.js";
|
|
17
|
-
import * as __glob__0_11 from "./
|
|
17
|
+
import * as __glob__0_11 from "./php/index.js";
|
|
18
18
|
import * as __glob__0_12 from "./ruby/index.js";
|
|
19
19
|
import * as __glob__0_13 from "./sh/index.js";
|
|
20
20
|
import * as __glob__0_14 from "./sql/index.js";
|