Closing tag is spit on log tags and log lines
spez opened this issue · 2 comments
spez commented
With a long line with a long tag name, the closing tag gets split and the contents are not indented.
Before
<textarea id="xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx">foo</textarea>
After
<textarea id="xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx">
foo</textarea
>
It works as expected with a div:
Before
<div id="xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx">foo</div>
After (as expected)
<div id="xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx">
foo
</div>
spez commented
It looks like it's an issue with prettier/parser-html.
wtanna commented
I also stumbled upon this and thought it was an issue. In case anyone else arrives here I found some documentation from Prettier on what this is:
- https://prettier.io/docs/en/options.html#html-whitespace-sensitivity
- https://prettier.io/blog/2018/11/07/1.15.0.html#whitespace-sensitive-formatting
- prettier/prettier#10134
In some cases it seems like adding
"htmlWhitespaceSensitivity": "ignore"
to the rules can fix some of the issues, but not all. Sometimes manually moving things around to new lines can resolve the weird formatting.