hediet / vscode-drawio

This unofficial extension integrates Draw.io (also known as diagrams.net) into VS Code.
https://marketplace.visualstudio.com/items?itemName=hediet.vscode-drawio
GNU General Public License v3.0
9.09k stars 414 forks source link

Make .dio.svg content diff friendly #119

Open Speedy37 opened 4 years ago

Speedy37 commented 4 years ago

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:

It can also be a mix of both as extracting the metadata is an easy task.

hediet commented 4 years ago

Nice idea! However, I think this should 1) either be implemented in draw.io itself (maybe we can open an issue in their repo?) 2) 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?

Speedy37 commented 4 years ago

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.

hediet commented 4 years ago

Did you find time / manage to get something working? ;)

Speedy37 commented 4 years ago

Not yet

hediet commented 4 years ago

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 ;)

Speedy37 commented 4 years ago

Thx for the proposition, but for now this is a hobby :)

septatrix commented 3 years ago

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.