Registry / devops / prettier-plugin-marko

prettier-plugin-marko

JSON →
library4.0.9jsnpmunverified

Prettier plugin for formatting Marko template files. Current stable version is 4.0.9, released February 2026. This plugin is maintained by the Marko team and is the official formatter for Marko files. It supports both HTML-like and concise syntax, auto-detecting the syntax used. It integrates with Prettier's CLI and editor plugins. Breaking change in v4.0.0: text adjacent to tags now prints on the same line when possible. Requires prettier v3 or later; for prettier@2, use version 2.x. Ships TypeScript types and has active patch releases.

npm install prettier-plugin-marko
INSTALL
IMPORT
SIG · PRETTIER-PLUGIN-MA
P
prettier-plugin-marko
devopsjavascriptv4.0.9
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 18226 runs
build_error
glibc
node 18226 runs
build_error
Code
Verified usage

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

default plugin
// In .prettierrc: { "plugins": ["prettier-plugin-marko"] }
// Do not import directly in code; the plugin is loaded by Prettier's config
The plugin is not imported in user code; it's referenced in Prettier configuration (e.g., .prettierrc or CLI --plugin). No JavaScript import needed.
Usage with CLI
npx prettier --write "**/*.marko" --plugin=prettier-plugin-marko
npx prettier --write "**/*.marko" --plugin=marko
Use full package name to avoid conflict with other plugins.
Config file example
// .prettierrc { "plugins": ["prettier-plugin-marko"] }
// .prettierrc { "plugins": ["prettier-plugin-marko"] } // This is correct, but many forget to add the plugin array.
Ensure plugins array is top-level in config. Also supports markoSyntax option.

Shows minimal setup: install packages, configure Prettier, create a Marko file, and format it.

// Install dependencies npm install --save-dev prettier prettier-plugin-marko // Create .prettierrc cat << EOF > .prettierrc { "plugins": ["prettier-plugin-marko"], "markoSyntax": "auto" } EOF // Create a sample Marko file cat << EOF > example.marko <div> <p> Hello World </p> </div> EOF // Format the file npx prettier --write example.marko
prettier --version
Debug
Known issues
breakingText adjacent to tags in HTML mode now prints on the same line when possible (v4.0.0).
fix
If you rely on previous formatting with separate lines, update your code or consider using markoSyntax: 'concise' to avoid auto-detection.
affects: >=4.0.0
gotchaThe plugin auto-detects syntax (HTML vs concise) by default. This may lead to inconsistent formatting if some files are HTML and others concise.
fix
Explicitly set markoSyntax option to 'html' or 'concise' in .prettierrc.
affects: >=3.0.0
deprecatedVersion 2.x works with prettier@2. Using version 4.x with prettier@2 will fail.
fix
Use prettier@3+ with prettier-plugin-marko@4, or prettier@2 with prettier-plugin-marko@2.
affects: >=4.0.0
gotchaThe plugin may change whitespace around placeholders like $!{} (v4.0.5 preserves them, but earlier versions might collapse).
fix
Update to v4.0.5 or later to preserve $!{} placeholders.
affects: <4.0.5
gotchaStatic block locations are preserved in v4.0.8, but previous versions might have reformatted them incorrectly.
fix
Update to v4.0.8+ to ensure static block positions are kept.
affects: <4.0.8
Errors
Common errors & fixes
Error: Could not find plugin "prettier-plugin-marko"
Plugin not installed or not referenced correctly in config.
fix
Run npm install --save-dev prettier-plugin-marko and ensure .prettierrc contains 'plugins': ['prettier-plugin-marko'].
Error: Cannot find module 'prettier-plugin-marko' from '...'
Plugin not installed or installed in wrong directory (e.g., global vs local).
fix
Install locally: npm install --save-dev prettier-plugin-marko. If using global prettier, install plugin globally too: npm install -g prettier-plugin-marko.
TypeError: prettier.resolveConfig is not a function
Using a version of Prettier that is incompatible (e.g., prettier@2 with plugin@4).
fix
Upgrade Prettier to v3+ or downgrade plugin to v2.
Unexpected token: ... in file.marko
The file contains syntax not supported by the Marko parser version used by the plugin.
fix
Update the plugin to the latest version: npm install prettier-plugin-marko@latest.
Upgrade
Version history
4.0.9latest on npm
Audit
Dependencies
prettierrequiredPeer dependency: the plugin requires Prettier to be installed
Agent activity
4 hits · last 30 days
node
4
Resources
prettier-plugin-marko — npm install prettier-plugin-marko · libregistry