Closed ghost closed 3 years ago
I believe the logic can be seen here. There is no way to configure this at this point.
For future reference, here's the correct permalink where the self-closing formatting can be found: https://github.com/bodoni/svg/blob/a391bb2b3bdd0f4e7d001895f731fb255800eabc/src/node/element/mod.rs#L68
Thank you for the correction. Right, one would have to distinguish two cases there: permitted to close without a closing tag or not, depending on the element. To this end, perhaps Element
should be extended with some flags to communicate more about how each element behaves.
Can anybody please provide a link to the spec that shows that certain tags are not permitted to be self-closing? If the current behavior is in accordance with the specification, nothing has to be changed.
I leave this one as a reference and close this issue:
https://stackoverflow.com/questions/24299969/closing-svg-tags-explicit-or-self-closing
Please shout if there is a contradicting and more reliable reference.
When the generated SVG is put into an HTML document and served into a browser, many browsers will autocorrect the markup. They will find tags that are not permitted to use />, and will automatically insert a closing tag.
E.g. becomes when loaded in an HTML page in Google Chrome.
Is it possible to disable the short version and force a verbose output ?
Edit: I'm using the to_string() method of Document to convert into string