NiklasPor / prettier-plugin-go-template

Fixes prettier formatting for go templates 🐹

Home Page:prettier-plugin-go-template-niklaspor.vercel.app

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Questionable formatting of `<script>` tags w/ v0.0.11

jasikpark opened this issue · comments

I'm not sure whether this is intended, but upgrading to v0.0.11 wants to make these changes:

https://github.com/jasikpark/jasik-xyz/commit/fe3f475d4f7903b1ba2d464b50e9d73989f258c9

It seems like a regression maybe? It definitely makes more sense to me for the <script> tags to start on their own lines, right?

@NiklasPor I just added this plugin to our website and the following line

{{ if .Params.Captcha }}<script src="https://www.google.com/recaptcha/api.js?hl={{ .Language.Lang }}"></script> {{ end }}

results in the error Error: Encountered unexpted end keyword.

maybe this is related to this problem as well. If not, its a new problem. I will try an earlier version now.

It does work but multiple other templates now result in the end-tags be replaced with HTML comments and then fail with the formatter.

Yes, looks like a regression. Script & style formatting is tricky because I actually am not able to format the code inside.

I'll add a test that covers this and fix it up. Thanks for reporting 🚀

After testing with both cases, it looks like 0.0.12-beta-1 is solving those problems.