![PyPI Now Supports iOS and Android Wheels for Mobile Python Development](https://cdn.sanity.io/images/cgdhsj6q/production/96416c872705517a6a65ad9646ce3e7caef623a0-1024x1024.webp?w=400&fit=max&auto=format)
Security News
PyPI Now Supports iOS and Android Wheels for Mobile Python Development
PyPI now supports iOS and Android wheels, making it easier for Python developers to distribute mobile packages.
prettier-plugin-astro
Advanced tools
Official Prettier plugin adding support for formatting .astro
files.
First install Prettier and the plugin:
npm i --save-dev prettier prettier-plugin-astro
Then add the plugin to your Prettier configuration:
// .prettierrc.mjs
/** @type {import("prettier").Config} */
export default {
plugins: ['prettier-plugin-astro'],
};
For optimal compatibility with the different package managers and Prettier plugins, we recommend manually specifying the parser to use for Astro files in your Prettier config as shown in the example below:
// .prettierrc.mjs
/** @type {import("prettier").Config} */
export default {
plugins: ['prettier-plugin-astro'],
overrides: [
{
files: '*.astro',
options: {
parser: 'astro',
},
},
],
};
To customize formatting behavior, see the Configuration section below.
Note The Astro VS Code extension 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:
Install the VS Code Prettier extension and add the following settings to your VS Code configuration:
{
"prettier.documentSelectors": ["**/*.astro"],
"[astro]": {
"editor.defaultFormatter": "esbenp.prettier-vscode"
}
}
The settings above ensure that VS Code is aware that Prettier can be used for Astro files, and sets Prettier as the default formatter for Astro files.
When submitting issues about formatting your .astro
files in VS Code, please specify which extension you are using to format your files: Astro's own extension or the Prettier extension.
Most options from Prettier will work with the plugin and can be set in a configuration file or through CLI flags.
Set if attributes with the same name as their expression should be formatted to the short form automatically (for example, if enabled <element name={name} />
will become simply <element {name} />
)
Default | CLI Override | API Override |
---|---|---|
false | --astro-allow-shorthand <bool> | astroAllowShorthand: <bool> |
If you are using another tool to format your JavaScript code, like Biome for example, it is possible to skip formatting the frontmatter.
Default | CLI Override | API Override |
---|---|---|
false | --astro-skip-frontmatter <bool> | astroSkipFrontmatter: <bool> |
.prettierrc.cjs
{
astroAllowShorthand: false;
astroSkipFrontmatter: false;
}
Pull requests of any size and any skill level are welcome, no contribution is too small. Changes to the Astro Prettier Plugin are subject to Astro Governance and should adhere to the Astro Style Guide.
See CONTRIBUTING.md for instructions on how to set up your development environment.
Astro is free, open source software made possible by these wonderful sponsors.
0.14.1
FAQs
A Prettier Plugin for formatting Astro files
We found that prettier-plugin-astro demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
PyPI now supports iOS and Android wheels, making it easier for Python developers to distribute mobile packages.
Security News
Create React App is officially deprecated due to React 19 issues and lack of maintenance—developers should switch to Vite or other modern alternatives.
Security News
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.