Search code examples
prettier

How to get Prettier to keep ending symbol of ending tag on the same line


For some reason, when I use an emmet abbreviation like this:
div>button.round-button+button>i.fas.fa-icons

and I save the file to trigger the Prettier formatter, it will format it like this:

<div>
    <button class="round-button"></button
    ><button><i class="fas fa-icons"></i></button>
</div>

But, on the third line, I don't want the line to start with the end of the first button tag

I've done a quick look through settings but I didn't find anything relating to this. Is there a setting I can change or would it be best to give feedback to Prettier?


Solution

  • Adding whitespace between the button tags is unsafe. It affects the output in the browser. Either add this whitespace manually if you need it or use the htmlWhitespaceSensitivity option if you don't care about the safety of the formatting.