Closed thinh105 closed 4 years ago
You might wan check this option --html-whitespace-sensitivity
You might wan check this option --html-whitespace-sensitivity
thanks, but I see in my code, there is no HTML whitespace, and I can edit manually and Prettier is ok with that ( no reformatting )
In my situation, the HTML text Shop
and {{ cartQuantity }}
still wrapped by span tag, so there is no HTML whitespace has been inserted unintendedly.
<div class="navigation-buttons">
<div class="is-pulled-right">
<router-link to="/products" class="button">
<i class="fa fa-user-circle"></i>
<span>Shop</span>
</router-link>
<routerlink to="/cart" class="button is-primary">
<i class="fa fa-shopping-cart"></i>
<span>{{ cartQuantity }}</span>
</routerlink>
</div>
</div>;
Exactly, there is no whitespace, so we have to break in this way. with --html-whitespace-sensitivity=ignore, this is what you want, but not safe, note there is extra space before <i>
.
Exactly, there is no whitespace, so we have to break in this way. with --html-whitespace-sensitivity=ignore, this is what you want, but not safe, note there is extra space before
<i>
.
oh, I just see the space before <i>
as you pointed.
I got the idea, thank for your help
I will keep what Prettier format :+1:
Prettier 2.0.5 Playground link
Input:
Output: On Playground with Vue Parser ( not working - don't know why ) on playground
Output: On Playground with html Parser and
--html-whitespace-sensitivity
:strict
on playground
As you can see in the result below, there is no white space on html text, but they still break in lines
Expected behavior:
I got this behavior when choosing HTML parser with
--html-whitespace-sensitivity
:ignore
in playgroundAlso, in VS Code, I can edit manually and Prettier is ok with that ( not undo to that above format )