sveltejs / prettier-plugin-svelte

Format your svelte components using prettier.
MIT License
735 stars 95 forks source link

Handlebars Error when inline code in html element #349

Closed devcaco closed 1 year ago

devcaco commented 1 year ago

So prettier is giving me an error and won't format the document when I include handlebars syntax inside an html element. For example

<li class="nav-item {{#if this.active}} active {{/if}}" style="flex-basis:0;">

The following error shows up

(error occurred in 'an unknown module' @ line 41 : column 95) (41:95)
  39 |             {{#each navmenu}}
  40 |               <ul class="nav flex-column justify-content-center">
> 41 |                 <li class="nav-item d-flex flex-row justify-content-between align-items-center {{#if this.active}} active {{/if}}" style="flex-basis:0;">
     |                                                                                               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

How can I make it to ignore those cases and format everything else?

dummdidumm commented 1 year ago

prettier-plugin-svelte assumes that you're using regular HTML (or pug) in the template. I don't know what kind of handlebars syntax this is, but it certainly isn't vanilla Svelte.

devcaco commented 1 year ago

Sorry