prettier-plugin-astro
Advanced tools
Comparing version 0.12.3 to 0.13.0
@@ -89,12 +89,9 @@ import { parse } from '@astrojs/compiler/sync'; | ||
function isInlineElement(path, opts, node) { | ||
return node && node.type === 'element' && !isBlockElement(node, opts) && !isPreTagContent(path); | ||
return node && isTagLikeNode(node) && !isBlockElement(node, opts) && !isPreTagContent(path); | ||
} | ||
function isBlockElement(node, opts) { | ||
return ((node && | ||
return (node && | ||
node.type === 'element' && | ||
opts.htmlWhitespaceSensitivity !== 'strict' && | ||
(opts.htmlWhitespaceSensitivity === 'ignore' || | ||
blockElements.includes(node.name))) || | ||
node.type === 'component' || | ||
node.type === 'fragment'); | ||
(opts.htmlWhitespaceSensitivity === 'ignore' || blockElements.includes(node.name))); | ||
} | ||
@@ -161,5 +158,2 @@ function isIgnoreDirective(node) { | ||
} | ||
if (node.type === 'fragment') { | ||
return false; | ||
} | ||
if (!isNodeWithChildren(node)) { | ||
@@ -466,3 +460,3 @@ return false; | ||
if (isInlineElement(path, opts, node) && !didSetEndSeparator) { | ||
noHugSeparatorEnd = softline$1; | ||
noHugSeparatorEnd = line$1; | ||
} | ||
@@ -469,0 +463,0 @@ trimTextNodeRight(lastChild); |
{ | ||
"name": "prettier-plugin-astro", | ||
"version": "0.12.3", | ||
"version": "0.13.0", | ||
"type": "module", | ||
@@ -5,0 +5,0 @@ "description": "A Prettier Plugin for formatting Astro files", |
@@ -45,9 +45,12 @@ # [Prettier](https://prettier.io/) Plugin for [Astro](https://astro.build/) | ||
## Using in VS Code | ||
## Formatting with the VS Code Prettier extension directly | ||
> **Note** | ||
> If you're using [Astro's VS Code extension](https://marketplace.visualstudio.com/items?itemName=astro-build.astro-vscode), Prettier and this plugin are already included. Only follow the guide below to format using Prettier's official extension. | ||
[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: | ||
First install the [VS Code Prettier extension](https://marketplace.visualstudio.com/items?itemName=esbenp.prettier-vscode) and add the following settings to your VS Code configuration: | ||
- You are not using Astro's VS Code extension. | ||
- 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. | ||
Install the [VS Code Prettier extension](https://marketplace.visualstudio.com/items?itemName=esbenp.prettier-vscode) and add the following settings to your VS Code configuration: | ||
```json | ||
@@ -96,3 +99,3 @@ { | ||
Astro is generously supported by Netlify, Storyblok, and several other amazing organizations. | ||
Astro is free, open source software made possible by these wonderful sponsors. | ||
@@ -99,0 +102,0 @@ [❤️ Sponsor Astro! ❤️](https://github.com/withastro/.github/blob/main/FUNDING.md) |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
107
105431
820