clean-html icon indicating copy to clipboard operation
clean-html copied to clipboard

Remove pre/post whitespace within style attributes

Open canadaduane opened this issue 1 year ago • 1 comments

Currently, clean-html transforms styles with whitespace into a clean wrapped set of lines, e.g.

<div style="
        font-family: -apple-system, system-ui, BlinkMacSystemFont, 'Segoe UI', Roboto;
        height: 100dvh;
        display: flex;
        flex-direction: column; 
        align-items: center;
        justify-content: center;
        color: #435d7b;
        background-color: #d0b641;
        gap: 20px;
      ">...</div>

to:

<div style=" font-family: -apple-system, system-ui, BlinkMacSystemFont, 'Segoe UI', Roboto; height: 100dvh; display:
        flex; flex-direction: column; align-items: center; justify-content: center; color: #435d7b; background-color:
        #d0b641; gap: 20px; ">
...
</div>

However, it leaves a space before the first style and after the last style. Would it be possible to strip these, i.e.:

<div style="font-family: -apple-system, system-ui, BlinkMacSystemFont, 'Segoe UI', Roboto; height: 100dvh; display:
        flex; flex-direction: column; align-items: center; justify-content: center; color: #435d7b; background-color:
        #d0b641; gap: 20px;">
...
</div>

canadaduane avatar Jun 27 '23 18:06 canadaduane