# prettier-plugin-go-template [![NPM Badge](https://img.shields.io/npm/v/prettier-plugin-go-template)](https://www.npmjs.com/package/prettier-plugin-go-template) [![CodeCov Badge](https://img.shields.io/codecov/c/github/niklaspor/prettier-plugin-go-template)](https://codecov.io/gh/NiklasPor/prettier-plugin-go-template) [![Contributions Badge](https://img.shields.io/github/all-contributors/niklaspor/prettier-plugin-go-template)](#contributors-) Formatter plugin for go template files. The only peer dependency is [prettier](https://www.npmjs.com/package/prettier). ```bash npm install --save-dev prettier prettier-plugin-go-template ``` Starting with Prettier 3 auto-discovery has been removed. Configuration is required ⬇️ ```json // .prettierrc { "plugins": ["prettier-plugin-go-template"] } ``` The following file types will be detected automatically: `.gohtml`, `.gotmpl`, `.go.tmpl`, `.tmpl`, `.tpl`, `.html.tmpl` If you want to add support for `.html` read the section on it below the examples.
Input | Output |
---|---|
```html {{ if or .Prev .Next -}} {{ $p := where site.Pages }} | {{ end -}} ``````html {{ if or .Prev .Next -}} {{ $p := where site.Pages }} | {{ end -}} ```
alqu 🐛 ⚠️ 💻 |
Gabriel Monteagudo 🐛 |
Bryan 🐛 |
Andreas Richter 🐛 |
Noah Brenner 💻 📖 |
silverwind 🤔 |
Charles Pence 🐛 |
Caleb Jasik 🐛 📖 💡 🤔 🚧 💬 |
Dan Gold 🐛 |
Michael Lynch 🐛 |