prettier-plugin-astro 0.14.0 → 1.0.0-beta.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 CHANGED
@@ -10,6 +10,14 @@ First install Prettier and the plugin:
10
10
  npm i --save-dev prettier prettier-plugin-astro
11
11
  ```
12
12
 
13
+ <details>
14
+ <summary>Installation with pnpm</summary>
15
+
16
+ ```shell
17
+ pnpm add --save-dev prettier prettier-plugin-astro
18
+ ```
19
+ </details>
20
+
13
21
  Then add the plugin to your Prettier configuration:
14
22
 
15
23
  ```js
@@ -44,8 +52,7 @@ To customize formatting behavior, see the [Configuration](#configuration) sectio
44
52
 
45
53
  ## Formatting with the VS Code Prettier extension directly
46
54
 
47
- > **Note**
48
- [The Astro VS Code extension](https://marketplace.visualstudio.com/items?itemName=astro-build.astro-vscode) uses Prettier and this plugin (`prettier-plugin-astro`) to format your code. You will only need to install the VS Code Prettier extension separately for formatting if:
55
+ > **Note** > [The Astro VS Code extension](https://marketplace.visualstudio.com/items?itemName=astro-build.astro-vscode) uses Prettier and this plugin (`prettier-plugin-astro`) to format your code. You will only need to install this plugin separately for formatting if:
49
56
 
50
57
  - You are not using Astro's VS Code extension.
51
58
  - You want to use features of the Prettier extension that not supported by Astro's own VS Code extension, such as the toolbar panel showing Prettier's status.
@@ -83,16 +90,27 @@ Set if attributes with the same name as their expression should be formatted to
83
90
 
84
91
  If you are using another tool to format your JavaScript code, like Biome for example, it is possible to skip formatting the frontmatter.
85
92
 
86
- | Default | CLI Override | API Override |
87
- | ------- | -------------------------------- | ----------------------------- |
93
+ | Default | CLI Override | API Override |
94
+ | ------- | --------------------------------- | ------------------------------ |
88
95
  | `false` | `--astro-skip-frontmatter <bool>` | `astroSkipFrontmatter: <bool>` |
89
96
 
97
+ ### Astro Compress HTML
98
+
99
+ Mirror of [`compressHTML`](https://docs.astro.build/en/reference/configuration-reference/#compresshtml) in `astro.config.mjs`. It tells the formatter which whitespace the compiler will collapse, so that reformatting a file never changes what it renders.
100
+
101
+ Astro's own default is `'jsx'` (since Astro 7.0.0), where a whitespace run containing a newline is dropped and a same-line space is content. Set this to match your project if you have changed `compressHTML`; `true` and `false` are accepted as aliases for `'html'` and `'none'` so the value can be copied across verbatim.
102
+
103
+ | Default | CLI Override | API Override |
104
+ | ------- | ---------------------------------- | ----------------------------------------------- |
105
+ | `'jsx'` | `--astro-compress-html <html\|jsx\|none>` | `astroCompressHTML: "html" \| "jsx" \| "none"` |
106
+
90
107
  ### Example `.prettierrc.cjs`
91
108
 
92
109
  ```js
93
110
  {
94
111
  astroAllowShorthand: false;
95
112
  astroSkipFrontmatter: false;
113
+ astroCompressHTML: 'jsx';
96
114
  }
97
115
  ```
98
116