4

This is my first interaction on Stackoverflow!

Is there a way, under vscode, using prettier or another solution, to format the following handlebars/HTML template:

<div 
  {{#if myOnclick}}
    onclick="{{myOnclick}}"
  {{/if}}
>
  Click me!
</div>

which actually gives the error: SyntaxError: A block may only be used inside an HTML element or another block.

The playground is available here.

I understand that prettier uses glimmer under the hood, and, quoting from the release notes: "This means Prettier won’t format Handlebars files that can’t be parsed into such a tree".

I think that this is the case here, but I suspect also that this is a fairly common use case.

Obviously, I can live without an auto-formatter, but it is better with it ;)

Any help on that topic would be much appreciated.

mgurzixo
  • 39
  • 2

0 Answers0