A Prettier plugin for HTML in WordPress Block Theme.
This plugin formats unique HTML code including Block markups in the WordPress block theme.
This plugin is currently in beta. It may return unexpected results.
In most cases, you can just install prettier-plugin-wp-block-html
and start using it. The plugin will work automatically after installation.
npm install -D prettier prettier-plugin-wp-block-html
If the plugin cannot be found automatically, you can load it as follows:
// prettier.config.js
module.exports = {
plugins: ["prettier-plugin-wp-block-html"],
};
Alternatively:
npx prettier --write ./parts/header.html --plugin prettier-plugin-wp-block-html
For more information, please refer to Prettier documentation.
This plugin uses specific Prettier APIs, which may conflict with other plugins that use similar APIs.
To avoid this problem, consider the order of the plugins
in the Prettier configuration file. Now you can use this plugin with prettier-plugin-tailwindcss
.
// .prettierrc.json
{
"plugins": ["prettier-plugin-tailwindcss", "prettier-plugin-wp-block-html"]
}