svg-sanitizer icon indicating copy to clipboard operation
svg-sanitizer copied to clipboard

Is it possible to preserve white spaces?

Open mrmacete opened this issue 7 months ago • 0 comments

Apparently all white spaces are lost at parse time because of this:

https://github.com/darylldoyle/svg-sanitizer/blob/master/src/Sanitizer.php#L105

$this->xmlDocument->preserveWhiteSpace = false;

is this vital to sanitisation or does it make sense to have it configurable (or even true by default) ?

there are legit SVG files, like the ones produced by the freeze tool [0] which rely on white spaces to properly format textual content sampled from terminals, and would be great to support them all the way down to WordPress sanitisation, as those are great for technical blogposts!

[0] https://github.com/charmbracelet/freeze/tree/main

mrmacete avatar Jul 04 '24 09:07 mrmacete