vscode-drawio
vscode-drawio copied to clipboard
Make .dio.svg content diff friendly
Currently the draw.io xml data is stored in base64 format within the content
attribute of the svg
element.
It would be nice to have an option to store this data directly in xml (svg is xml) within the svg.
For example we could that information within the metadata element
<svg>
<metadata>
<mxfile ...>
...
</mxfile>
</metadata>
...
</svg>
There is two ways to do this task:
- Preprocess/postprocess svg input/output (slower but easy to implement)
- Extract the metadata, hack into draw.io svg+xml extraction process (faster but hard to implement)
It can also be a mix of both as extracting the metadata is an easy task.
Nice idea! However, I think this should
- either be implemented in draw.io itself (maybe we can open an issue in their repo?)
- or with forward compatibility so that the web app can still open such a file. This could be achieved by keeping the content attribute as a fall back, along your proposed metadata elemetn.
I want to avoid creating an incompatible format. Also, are you sure that no SVG processing tool interprets your proposed metadata
element?
Upstreaming changes to the encoding/decoding step to draw.io seems the best way to proceed.
Changes should be minimal and would only requires a new option to the message API.
Depending on how my free time goes this week, I might find some time to allocate experimenting with this approach.
Did you find time / manage to get something working? ;)
Not yet
Btw. if you have paypal or github sponsors, I can share some of the amount I get from github sponsors with you for your work on this extension ;)
Thx for the proposition, but for now this is a hobby :)
I agree in that this is an upstream issue. However this is probably more involved than you think as SVG does not support any element (to my knowledge). Therefore a new namespace would have to be defined and declared. What I am doing currently is saving the File as uncompressed XML which seems to do the job just fine.