by tasuki · 7mo ago · 0 comments
I open a simple hand-crafted SVG and want to make a simple change. It messes up all my formatting and uses its own weird formatting, with line breaks between attributes. I'd rather it at least put newlines between elements rather than between attributes. Ideally there'd be a "save with minimal edits from the original" button.
Literally everything else about Inkscape is amazing! Congrats to the team!
~~~
Maybe this is also the right time & place to plug my favourite SVG path editor? https://yqnn.github.io/svg-path-editor/ - free as in both beer and freedom, a tool to craft minimalistic well-behaved SVG paths.
Are you aware of any XML parser ever which preserves the plaintext formatting of the .xml file while magically inserting and modifying an arbitrary amount of XML data anywhere within the document?
SVG is just XML. Save your file in Inkscape, and then run `tidy` on it, or whatever you like for format your XML with.
(As a fellow hand-crafted XML fan, I feel your pain. But I also know when to choose my battles!)
Running `tidy` is of not enough help. I handle the situation by saving into a new file, then copy-paste the changed bits into my hand-crafted SVG and clean them up.
Ideally I try to avoid Inkscape altogether. Which is hard, as it's just too good.
I have also had trouble with some generated SVGs, for example:
https://gitlab.com/inkscape/inkscape/-/issues/5317
Part of the problem is that Inkscape is too good, and the file format it uses mostly conforms to standards, so I have the expectation that opening arbitrary SVGs would just work. With other programs that use proprietary formats, I wouldn't have tried to generate drawings at all. It's a bummer when I run into what seem to be corner cases of Inkscape's SVG handling, but fortunately the set of corner cases seem to be shrinking.
Inkscape on the other hand almost inevitably creates really messy SVGs with a lot of transforms (why??) that make it almost impossible to see actual coordinates.
But as I said, nobody cares about how clean and nice your SVG paths are and I don't either most of the time, so I'm still a regular user of Inkscape. Thanks to the team :)
I highly recommend using SVGO (https://svgo.dev/).