I’m using VSCode as code editor for working with Hugo (I’m using Visual Studio as my primary IDE, so your (probably) answer(s) can be for that too)
I have a problem, as you know, the partials/templates are html files (it can be anything but by default are html), inside this files, we use Go (I think) language too (for ex. {{ if isset ... }}), for heavy/complex templates I usually format my .html file like this:
{{ if ...}}
<div>its just example</div>
{{ end }}
So far so good, but if I try to format my file, above format will be broken to:
{{ if ...}}<div>its just example</div>{{ end }}
I googled about that, but I found nothing, I’m not familiar with Go (and Go template), so maybe there is some extension/solution to solve this problem, if so please let me know.
I’m an ST3 user, so it’s unlikely that I’ll be of any help. That said, have you tried reading through the documentation for the actual VSCode plugin you’re using? I’m guessing this is what you’re currently working with:
Other than that, perhaps a beautify/prettify plugin that accepts handlebars syntax, since my assumption would be that the plugin ignores the double curlies…
FWIW, I have this same issue with prettifying HTML in ST3 and think it’s really annoying…
Thanks, I tired both of them, first one kill my formatting as I mentioned, second one just add some short way to run Hugo command.
I’m working with handlebars (in my ASP.NET & NodeJS projects), I tired to use .hbs instead of .html for my partials, but it doesn’t help as I expected. because there is no formatter plugin that support handlebars. they are just syntax highlighter.