g-plane / markup_fmt

Configurable HTML, Vue, Svelte, Astro, Angular, Jinja, Twig, Nunjucks and Vento formatter with dprint integration.
https://dprint.dev/plugins/markup_fmt/
MIT License
100 stars 9 forks source link

Conditional attributes in Vento templates #22

Closed noelforte closed 3 months ago

noelforte commented 5 months ago

Description

When there are directives in the tag of the markup, dprint fails to format.

{{ set test = true }}

<p{{ if test }} class="my-class"{{ /if }}></p>

This works, but leaves behind an empty attribute.

{{ set test = true }}

<p class="{{ if test }}my-class{{ /if }}"></p>

Output of error

Error formatting /***/test.vto. 
Message: syntax error 'expect self close tag' at line 3, column 38

Reduced test case

https://github.com/noelforte/dprint-vento-format-rtc

g-plane commented 5 months ago

That's one of known limitations when formatting Vento templates.