Registry / devops / prettier-plugin-marko-htmljs

prettier-plugin-marko-htmljs

JSON →
library0.1.1jsnpmunverified

A Prettier plugin for Marko templates that uses the htmljs-parser (^5) instead of @marko/compiler. Version 0.1.1 is current; development is active with monthly releases. Key differentiators: follows Prettier's HTML formatting rules (empty line collapsing, separate close tags for non-void elements, bracketSameLine support) and supports prettier-ignore comments. Does not support Marko concise mode. Requires Prettier ^3 as a peer dependency.

npm install prettier-plugin-marko-htmljs
INSTALL
IMPORT
SIG · PRETTIER-PLUGIN-MA
P
prettier-plugin-marko-htmljs
devopsjavascriptv0.1.1
Install
Import
Disk
Pass rate
0/ 6
Env Coverage0 / 6
glibc
1822
musl
1822
Install & Compatibility
Where this runs
tested against v? · npm install
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
node 18223 runs
build_error
glibc
node 18223 runs
build_error
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

(plugin)
// Add to .prettierrc: { "plugins": ["prettier-plugin-marko-htmljs"] }
Missing plugin configuration – prettier won't recognize .marko files
No import needed; plugin auto-detects .marko files when configured in .prettierrc.

Install and configure the plugin, then run prettier on Marko files.

// Install plugin and peer dependencies npm install --save-dev prettier-plugin-marko-htmljs htmljs-parser prettier@^3 // .prettierrc { "plugins": ["prettier-plugin-marko-htmljs"], "bracketSameLine": false, "singleAttributePerLine": false } // Format all .marko files npx prettier --write "**/*.marko"
Debug
Known issues
gotchaNot compatible with @marko/compiler-based formatting; behavior diverges on empty lines and void elements.
fix
Use this plugin exclusively for Marko formatting; do not mix with prettier-plugin-marko.
affects: >=0.0.0
deprecatedConcise mode syntax is untested and may produce invalid output.
fix
Write all templates in HTML-like (non-concise) mode.
affects: >=0.0.0
gotchaprettier-ignore only works on elements with a closing tag; self-closing elements cannot be ignored.
fix
Wrap content in a div or other container to use prettier-ignore.
affects: >=0.0.0
breakingMay reformat <pre> tag content despite prettier-ignore missing; known issue.
fix
Use prettier-ignore on the <pre> element or its parent.
affects: >=0.0.0
Errors
Common errors & fixes
Error: Cannot find module 'htmljs-parser'
Missing peer dependency htmljs-parser
fix
npm install --save-dev htmljs-parser
Error: Cannot find module 'prettier-plugin-marko-htmljs'
Plugin not installed or not listed in package.json
fix
npm install --save-dev prettier-plugin-marko-htmljs
[error] .marko: SyntaxError: Expected attribute value but got "<"
Using concise mode syntax which is unsupported
fix
Rewrite template using HTML-like syntax with explicit tags.
Upgrade
Version history
0.1.1latest on npm
Audit
Dependencies
htmljs-parserrequiredpeer dependency for parsing Marko files
prettierrequiredpeer dependency, requires version ^3
Agent activity
4 hits · last 30 days
node
4
Resources
prettier-plugin-marko-htmljs — npm install prettier-plugin-marko-htmljs · libregistry