How to re-format HTML (in vscode) to remove unnecessary line breaks after every tag

34 Views Asked by At

I know that most code formatters have config to prevent breaking on <b>, <i> etc tags, but I cannot figure out what to do if the disaster already happened and I want to go back from 1000 line long files like this:

<li>
  something
  <b>
    <font color="green">something</font>
  </b>
  something
  <b>
    <font color="red">something</font>
  </b>
  something.
</li>

to code like this:

<li>something <b><font color="green">something</font></b> something <b><font color="red">something</font></b> something.</li>

I'd like to only wrap on p, h1-6, br, li, div, input etc and remove the rest to greatly compress the number of lines in some HTMLs (to have up to 120 character long lines instead of 10x as many lines).

0

There are 0 best solutions below