A fork of Prettier (v3.3.2) that adds custom indentation for HTML attributes, which is impossible to achieve via official plugins or options. This package allows setting a specific indentation width for HTML attributes (htmlAttributeIndent) and defining attributes that should stay on the same line as the tag (sameLineAttributes). It supports JavaScript, TypeScript, JSX, CSS, HTML, Vue, Angular, and more. The fork follows Prettier's release cadence and is compatible with Prettier's existing options and plugins. It is actively maintained as a separate package.
npm install prettier-custom-html-indentVerified import paths — ran on the pinned version, not inferred.
Formats HTML with custom attribute indentation (2 spaces) and keeps 'id' on the same line as the tag.
Uninstall prettier and install prettier-custom-html-indent.
Monitor the package for updates; consider pinning the version.
Ensure you are formatting HTML files or set parser: 'html' or 'babel' for JSX.
Change import to 'prettier-custom-html-indent'.
Install and import from 'prettier-custom-html-indent'.
Use: const prettier = require('prettier-custom-html-indent'); or import prettier from 'prettier-custom-html-indent'.