# New template formatter under test

**URL:** <https://discourse.gohugo.io/t/new-template-formatter-under-test/56933>\
**Category:** Announcements\
**Created:** [March 29, 2026, 3:01pm UTC](https://discourse.gohugo.io/t/new-template-formatter-under-test/56933 "2026-03-29T15:01:34Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![bep](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/bep/32/3332_2.png) [@bep](https://discourse.gohugo.io/u/bep)\
**Post date:** [March 29, 2026, 3:01pm UTC](https://discourse.gohugo.io/t/new-template-formatter-under-test/56933/1 "2026-03-29T15:01:34Z")

</div>

See: [GitHub - gohugoio/gotmplfmt: Work in progress. · GitHub](https://github.com/gohugoio/gotmplfmt)

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](https://github.com/gohugoio/gotmplfmt/issues)

For installation, see [GitHub - gohugoio/gotmplfmt: Work in progress. · GitHub](https://github.com/gohugoio/gotmplfmt?tab=readme-ov-file#usage)  
For VS COde, see [gotmplfmt/vscode/README.md at main · gohugoio/gotmplfmt · GitHub](https://github.com/gohugoio/gotmplfmt/blob/main/vscode/README.md#local-development)

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

---

<div class="post-metadata">

**Author:** ![bep](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/bep/32/3332_2.png) [@bep](https://discourse.gohugo.io/u/bep)\
**Post date:** [March 29, 2026, 3:01pm UTC](https://discourse.gohugo.io/t/new-template-formatter-under-test/56933/2 "2026-03-29T15:01:45Z")

</div>



---

<div class="post-metadata">

**Author:** ![htnabe](https://avatars.discourse-cdn.com/v4/letter/h/dc4da7/32.png) [@htnabe](https://discourse.gohugo.io/u/htnabe)\
**Post date:** [June 16, 2026, 3:13pm UTC](https://discourse.gohugo.io/t/new-template-formatter-under-test/56933/3 "2026-06-16T15:13:20Z")

</div>

I tried using gotmplfmt, but compared to prettier-plugin-go-template, I noticed a few unintended formatting changes. Here is an example.

from this

```auto
<time datetime="{{ .Date.Format " 2006-01-02T15:04:05JST“ }}”
            >{{ .Date.Format (
              .Site.Params.dateformat |
              default “2006/01/02”)
            }}</time
          >

```

to this.

```auto
<time datetime="{{ .Date.Format " 2006-01-02T15:04:05JST“ }}”
                    >{{ .Date.Format
    (.Site.Params.dateformat | default “2006/01/02”)
}}</time
                    >

```

If there isn’t enough time to implement this, I thought it might be a good idea to fork `prettier-plugin-go-template` and rebuild or update it as a separate npm package. Personally, I think developers should be free to choose between tab and space indentation.

By the way, since I have some expertise in this area, I think I could fork it and handle updates and issue responses.

---

<div class="post-metadata">

**Author:** ![bep](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/bep/32/3332_2.png) [@bep](https://discourse.gohugo.io/u/bep)\
**Post date:** [June 16, 2026, 5:05pm UTC](https://discourse.gohugo.io/t/new-template-formatter-under-test/56933/4 "2026-06-16T17:05:02Z")

</div>

> [@htnabe](#):
>
> ```auto
> <time datetime="{{ .Date.Format " 2006-01-02T15:04:05JST“ }}”
> >{{ .Date.Format (
> .Site.Params.dateformat |
> default “2006/01/02”)
> }}</time
> >
> 
> ```

If start out with something, in my eyes, messy like the above, you shouldn’t be surprised that the output from a new formatter would be different and slightly undefined.

I suggest you do some manual reformatting of this one.

> [@htnabe](#):
>
> By the way, since I have some expertise in this area, I think I could fork it and handle updates and issue responses.

Best of luck!

---

<div class="post-metadata">

**Author:** ![bep](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/bep/32/3332_2.png) [@bep](https://discourse.gohugo.io/u/bep)\
**Post date:** [June 18, 2026, 5:05pm UTC](https://discourse.gohugo.io/t/new-template-formatter-under-test/56933/5 "2026-06-18T17:05:18Z")

</div>

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.
