New template formatter under test

See: GitHub - gohugoio/gotmplfmt: Work in progress. · GitHub

The most commonly used formatter for Go templates have been prettier-plugin-go-template, but that one is 1. No longer actively maintained (last commit was 3 years ago), 2. Was a little bit of a hazzle to install and 3. Had some quirks inherited from the Prettier HTML formatter that you either loved or hated …

So, I have spent parts of the weekend continuing the works from others and gotten to a state where I’m pretty happy with the output (I have tested this on all of the Hugo embedded templates + all the Hugo docs templates).

It’s still needs some work/more testing, but I appreciate any feedback if you …

  • Don’t agree with some of the choices I made (and have a convincing argument)
  • Or you find a bug.

Create an issue here: GitHub · Where software is built

For installation, see GitHub - gohugoio/gotmplfmt: Work in progress. · GitHub
For VS COde, see gotmplfmt/vscode/README.md at main · gohugoio/gotmplfmt · GitHub

(I will eventually get it into the VS code extension store)

1 Like