@grgmddn/prettier-plugin-velocity-html weekly downloads statistics
By grgmddn · npm · Prettier plugins
Prettier 3 plugin for formatting HTML containing Velocity code
@grgmddn/prettier-plugin-velocity-html has 32 recorded weekly downloads on npm, a change of -91.4% over the past 7 days, ranking #2887 of 3,247 tracked listings.
About @grgmddn/prettier-plugin-velocity-html
@grgmddn/prettier-plugin-velocity-html
A Prettier 3 plugin that formats HTML containing Apache Velocity code.
This is a fork of fvclaus/prettier-plugin-velocity-html, updated for Prettier 3. If you are on Prettier 2, use the original package. See Attribution.
Installation
Install the plugin as a dev dependency:
npm install --save-dev prettier @grgmddn/prettier-plugin-velocity-html
Then add it to your Prettier configuration:
// .prettierrc
{
"plugins": ["@grgmddn/prettier-plugin-velocity-html"]
}
Or, with a JavaScript config:
// prettier.config.mjs
export default {
plugins: ["@grgmddn/prettier-plugin-velocity-html"],
};
Files ending in .vm are formatted automatically. For other extensions, set the parser in an override:
{
"plugins": ["@grgmddn/prettier-plugin-velocity-html"],
"overrides": [{ "files": "*.htm", "options": { "parser": "velocity-html" } }]
}
Usage
CLI
npx prettier --write "src/**/*.vm"
To load the plugin without a config file:
npx prettier --plugin=@grgmddn/prettier-plugin-velocity-html --write "src/**/*.vm"
API
import * as prettier from "prettier";
const output = await prettier.format(source, {
parser: "velocity-html",
plugins: ["@grgmddn/prettier-plugin-velocity-html"],
});
Motivation
Prettier's HTML parser is robust and can parse most Velocity code. There are only two cases it can't handle:
- HTML elements inside Velocity strings:
#set($htmlElement = "<div>") - Velocity fragments that aren't well-formed HTML on their own, such as a
footer.vmcontaining</div></div><div>Footer text ...</div></body></html>
Even where Prettier can parse Velocity HTML, it is unlikely to improve the formatting. It treats every Velocity directive as text and lays it out as such:
Original
#set ($serviceName = $context.serviceName)
#if ($serviceName)
<legend>
#encodeForHTML($serviceName)
</legend>
#else
<legend>
Login to anonymous service
</legend>
#end
Prettier HTML
#set ($serviceName = $context.serviceName) #if ($serviceName)
<legend>#encodeForHTML($serviceName)</legend>
#else
<legend>Login to anonymous service</legend>
#end
Prettier Velocity HTML
#set($serviceName = $context.serviceName)
#if($serviceName)
<legend>#encodeForHTML($serviceName)</legend>
#else
<legend>Login to anonymous service</legend>
#end
How it works
Elements are rendered in one of two modes, block or inline:
- Block elements break their children uniformly. Whitespace is not significant, and opening and closing tags are never broken.
- Inline elements fill as much horizontal space as possible. Whitespace is significant, so the opening or closing tag is broken where necessary to avoid inserting whitespace that was not in the original code.
The mode is chosen from the element name. It describes how elements are laid out in code, not how a browser renders them. Block mode is used to improve readability wherever whitespace has no meaning.
Inline
<span> inline </span><span> inline </span> <span> inline </span><span>
inline</span
>
Block
<datalist id="colors">
<option>Blue</option>
<option>Green</option>
</datalist>
The plugin ships with its own HTML parser, tested against all relevant test cases from Prettier's HTML parser. Output is not always identical to Prettier's HTML formatter, because some cases were simplified to avoid the complexity of Prettier's codebase.
What's different in this fork
- Supports Prettier v3. Prettier 2 is no longer supported; use the original package for v2.
- Dual ESM/CJS builds, Node.js
>=18. - No runtime dependencies.
- Published as the scoped package
@grgmddn/prettier-plugin-velocity-html. - The hosted Playground has been removed.
- Parser generated with
antlr-ng, built withtsdown, tested withnode:test. Java is not required to generate the lexer.
Contributing
npm install
npm run build # generate the parser and bundle
npm test # build, then run the test suite
npm run verify # format check, lint and type check
Issues and pull requests are welcome at grgmddn/prettier-plugin-velocity-html.
Attribution
This package is a fork of prettier-plugin-velocity-html by Frederik Claus, updated for compatibility with Prettier v3. The original design, parser, motivation and tests described above are his work.
Description from the npm listing.
- prettier
- prettier-plugin
- velocity
README badge
Show your rank in a README or on your website. The badge updates automatically.
Charts
Images: 30d · 1y · all time · 1600×900 dark
Adoption over time
7/30/90-day growth
Ranking history
Listing placement
Listing placement
Filled points are observed values; hollow points come from Internet Archive snapshots of the listing page. Dashed segments span periods with no observations — values between points are not interpolated.
Each band is one page of 20. Weekly downloads on a linear scale. Placement is projected from weekly downloads, so it can differ from the marketplace's own sort order. Hover a dot to see the listing.
Recent observations
Full history (121)Similar npm Prettier plugins plugins
All 20 @grgmddn/prettier-plugin-velocity-html alternativesData source
Weekly downloads (trailing 7 complete days) come from the official npm downloads API. Downloads include CI and mirrors and are not equivalent to installs or users. npm publishes no ratings.
Listing: https://www.npmjs.com/package/@grgmddn/prettier-plugin-velocity-html. First seen Nov 30, 2026; last successful collection Dec 6, 2026. See the methodology.