You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Describe the bug
When using the Prettier plugin prettier-plugin-antlers some of my HTML tags end up with extra spacing before and after the tag because they are wrapped onto separate lines.
Impacted Products
Which Antlers Toolbox products does this bug apply to?
Antlers Prettier Plugin
Versions and Other Plugins/Extensions
These are the versions of Prettier and the two plugins I have installed...
To Reproduce
Create an example.html file with this content.
<header><nav><ul>
{{ if collection == "software" or slug == "software" }}
<li>
{{ if 1 }}
<ahref="/short" class="text-black">Short</a>
{{ /if }}
</li>
{{ /if }} {{ if collection == "press" or slug == "press" }}
<li>
{{ if 1 }}
<ahref="/long" class="text-black">A Much Longer Label</a>
{{ /if }}
</li>
{{ /if }}
</ul></nav></header>
As formatted by Prettier this looks pretty bad from the Antlers perspective, but notice that the spacing inside HTML tag pairs is left intact.
Now create another file named example.antlers.html with the same content in it. After formatting the content with Prettier it will now look like this...
<header><nav><ul>
{{ if collection == "software" or slug == "software" }}
<li>
{{ if 1 }}
<ahref="/short" class="text-black">Short</a>
{{ /if }}
</li>
{{ /if }}
{{ if collection == "press" or slug == "press" }}
<li>
{{ if 1 }}
<ahref="/long" class="text-black">
A Much Longer Label
</a>
{{ /if }}
</li>
{{ /if }}
</ul></nav></header>
Note the extra spacing around the "much longer" label. In HTML this extra space is (unfortunately) significant and in our case the result is noticeably different. While the Antlers code looks better, the actual HTML is "broken."
Expected behavior
I expect the prettier-plugin-antlers to leave all spacing inside HTML tags intact. This means that it cannot add line breaks for Antlers code either, unless that code is outside of a tag.
Alternatively, I need the plugin to at least respect HTML spacing and not add new line breaks inside HTML code that does not include further Antlers tags.
If submitting a formatting bug, please include the template contents below as well as an attachment
I've included that above in the reproduction section.
Additional context
None.
The text was updated successfully, but these errors were encountered:
Describe the bug
When using the Prettier plugin
prettier-plugin-antlers
some of my HTML tags end up with extra spacing before and after the tag because they are wrapped onto separate lines.Impacted Products
Which Antlers Toolbox products does this bug apply to?
Antlers Prettier Plugin
Versions and Other Plugins/Extensions
These are the versions of Prettier and the two plugins I have installed...
The installed versions are the ones shown here.
To Reproduce
Create an example.html file with this content.
As formatted by Prettier this looks pretty bad from the Antlers perspective, but notice that the spacing inside HTML tag pairs is left intact.
Now create another file named
example.antlers.html
with the same content in it. After formatting the content with Prettier it will now look like this...Note the extra spacing around the "much longer" label. In HTML this extra space is (unfortunately) significant and in our case the result is noticeably different. While the Antlers code looks better, the actual HTML is "broken."
Expected behavior
I expect the
prettier-plugin-antlers
to leave all spacing inside HTML tags intact. This means that it cannot add line breaks for Antlers code either, unless that code is outside of a tag.Alternatively, I need the plugin to at least respect HTML spacing and not add new line breaks inside HTML code that does not include further Antlers tags.
If submitting a formatting bug, please include the template contents below as well as an attachment
I've included that above in the reproduction section.
Additional context
None.
The text was updated successfully, but these errors were encountered: