clean-html
clean-html copied to clipboard
Self-closing path has slash/closing tag stripped
Edited for clarity.
For instance, <path d="..."/> becomes <path d="..."> (which is breaking, since the tag doesn't close).
Even <path d="..."> </path> becomes <path d="...">.
I can confirm the same issue
Sorry it's taken me a while to get around to looking at this. I'm a little rusty, so help me out. path is a void element, right? Is it somehow different from other void elements, in that it needs the closing slash? In other words, <br> and <br/> are the same, but not <path> and <path/>?
path is not a void element (SVG is not HTML). https://www.w3.org/TR/html/syntax.html#writing-html-documents-elements
It can be self-closing, but the self-closing needs to be explicit for SVG paths. This Stack Overflow thread might be helpful: https://stackoverflow.com/a/31120364/631345
I think this is a good use case for the new preserve-tags option added in 6a1cc0d, e.g. --preserve-tags math,svg.
I'll add those to the list of defaults.