Open jraller opened 2 months ago
It looks like this dates back to https://github.com/trivago/prettier-plugin-twig-melody/issues/53
You should be able to work around that by constructing the whole start and end tags with one big string you then render with |raw
. That's what I did in the past. It isn't beautiful. It isn't "handy" (because you don't get nesting), but it works for those edge cases.
example:
{% set start_tag = "<#{tag} #{attributes.defaults....}>" %}
{{ start_tag|raw }}
In a twig component I have:
Which prettier-plugin-twig responds to with:
I've used
symfony console lint:twig templates
which doesn't report any lint issues with the twig syntax the way I'm using it. Can the parser be set to allow a tag to start with{{ variable }}
, in my case<{{ tag }}
?The functional reason for this is that this twig component defaults to
<button
but it is possible to pass it a tag value in which case you could cause it to render as<a
instead.