I have this HTML when I use the built-in formatter. Not good. I want every tag to be cascaded. Here, we have span and svg and a on same line.
After formatting with prettier (this version)
I get this. This is almost worse. (see edit section later that explains why it’s actually a smart choice from prettier.)
Prettier config is
What can I use to properly auto format this HTML ?
Edit: I got what I want with the Beautify extension and editing its inline config.
Here is why prettier is formatting like this. It is a workaround to not break content display. Actually, it is pretty smart once you get used to it.
You can override it with the option
"prettier.htmlWhitespaceSensitivity": "ignore",
See the link above to know more about this.