https://github.com/marko-js/prettier
A prettier plugin for parsing and printing Marko files.
https://github.com/marko-js/prettier
Last synced: 5 months ago
JSON representation
A prettier plugin for parsing and printing Marko files.
- Host: GitHub
- URL: https://github.com/marko-js/prettier
- Owner: marko-js
- License: mit
- Created: 2021-08-30T18:07:02.000Z (almost 4 years ago)
- Default Branch: main
- Last Pushed: 2024-12-13T22:13:45.000Z (6 months ago)
- Last Synced: 2024-12-28T19:02:52.534Z (6 months ago)
- Language: Marko
- Size: 524 KB
- Stars: 13
- Watchers: 7
- Forks: 7
- Open Issues: 3
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
- Code of conduct: .github/CODE_OF_CONDUCT.md
Awesome Lists containing this project
README
prettier-plugin-marko
> Note:
> For prettier@2 or below use `prettier-plugin-marko@2`.A [Prettier](https://prettier.io/) plugin for parsing and printing Marko files.
# Installation
### npm
```console
npm install prettier prettier-plugin-marko -D
```### yarn
```console
yarn add prettier prettier-plugin-marko -D
```# Usage
## NPM 6
```console
npx --no-install prettier --write "**/*.marko"
```## NPM 7
```console
npm exec -- prettier --write "**/*.marko"
```## Yarn
```console
yarn prettier --write "**/*.marko"
```## Editors
Editors such as [Atom](https://atom.io/packages/prettier-atom) and [VSCode](https://marketplace.visualstudio.com/items?itemName=esbenp.prettier-vscode) provide plugins for calling [Prettier](https://prettier.io/) directly from your editor.
If you'd like to use these plugins **without** installing `prettier-plugin-marko` in the project, you can also install `prettier-plugin-marko` globally with either [npm](https://docs.npmjs.com/downloading-and-installing-packages-globally), [yarn](https://classic.yarnpkg.com/en/docs/cli/global/) or your package manager choice.
# Options
On top of [Prettier's options](https://prettier.io/docs/en/options.html), there are a few additional options picked up by this plugin.
## `markoSyntax: "auto" | "html" | "concise"`
Marko supports both an [html like](https://markojs.com/docs/syntax/) and [concise](https://markojs.com/docs/concise/) syntaxes.
By default this plugin will try to detect the syntax you are already using and output a formatted document in that syntax.You can overide the default (`"auto"`) to enforce that all templates are formatted to the syntax of your choosing.
## `markoAttrParen: boolean`
For the most part Marko is very flexible when it comes to the [expressions uses within attributes](https://markojs.com/docs/syntax/#attributes).
By default this plugin will not wrap attribute values in parenthesis unless absolutely necessary. By setting this value to true it will instead output parenthesis whenever the attribute value contains any unenclosed whitespace.# Code of Conduct
This project adheres to the [eBay Code of Conduct](./.github/CODE_OF_CONDUCT.md). By participating in this project you agree to abide by its terms.