-
Notifications
You must be signed in to change notification settings - Fork 24
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Formatting fails for HTML custom elements #84
Comments
mtlynch
added a commit
to mtlynch/picoshare
that referenced
this issue
May 13, 2022
There seems to be a bug in prettier-plugin-go-template that prevents it from formatting custom elements correctly when they contain Go template syntax, so we're tightening the matcher for Go templates to not match HTML custom elements. See: NiklasPor/prettier-plugin-go-template#84
mtlynch
added a commit
to mtlynch/picoshare
that referenced
this issue
May 13, 2022
There seems to be a bug in prettier-plugin-go-template that prevents it from formatting custom elements correctly when they contain Go template syntax, so we're tightening the matcher for Go templates to not match HTML custom elements. See: NiklasPor/prettier-plugin-go-template#84
Hey, thanks for reporting the issue 👏 Could you check whether |
@NiklasPor - wow, fast fix! Yep, I tried installing the beta and confirmed 71dc2e7 works on all of my custom element files. |
Great, I'll publish |
@all-contributors please add @mtlynch for bug |
I've put up a pull request to add @mtlynch! 🎉 |
DmitroProciv
added a commit
to DmitroProciv/picoshare
that referenced
this issue
Jan 4, 2025
There seems to be a bug in prettier-plugin-go-template that prevents it from formatting custom elements correctly when they contain Go template syntax, so we're tightening the matcher for Go templates to not match HTML custom elements. See: NiklasPor/prettier-plugin-go-template#84
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I'm still loving this plugin. Thanks so much for your work on this!
I'm noticing an issue when I try to use it on HTML custom elements that include Go templating.
Works fine
In the following example without any Go template syntax, the prettier-plugin-go template works fine:
Failure to process templated attributes
If I add templated attributes (the
nonce={{ .Nonce }}
attributes), the plugin seems to get confusedOriginal
Formatted
And then it mostly stops formatting. So if I add lots of whitespace in the
<script>
section, the formatter doesn't touch it:Workaround
For this use case, the vanilla Prettier formatter formats the code correctly, so I can work around it by using more targeted matchers in my
prettierrc
to prevent prettier-plugin-go-template from handling these files.The text was updated successfully, but these errors were encountered: