1
votes

Context: at my company, we document our architecture with multi-page Draw.io diagrams. These diagrams are included in a statically-generated documentation website. This works well, especially because we can link diagrams and website content.

Problem: now that the documentation has grown, we sometimes have several developer modifying the same Draw.io diagram in different Pull Requests. And Draw.io XML format is not very good at merging... so we had to resolve to "soft locking" the diagrams (with good old communication and .OWNERS files) to avoid 2 PR to modify the diagram at the same time.

I did not find any reference to a merging plugin. Latest versions of Draw.io desktop app and web editor allow collaborative editing, but I didn't find a way to start from that to write a merge tool. Any ideas how to proceed ? Do you have recommendations on the best way to handle that issue ?

1
Does draw.io provide some sort of mergetool/difftool?dan1st
You could make your own locking mechanism in order to prevent concurrent access.dan1st

1 Answers

0
votes

According to Format of Draw.io XML file?, the .drawio filetype may contain either raw XML or XML deflate-compressed data.

This is also supported by the offical docs:

The default format for saving diagrams was changed some time ago from raw XML to XML compressed using standard deflate. The main reason for this was that when Google’s server are struggling a compressed file has a much better chance of writing. That said, the raw XML may be useful to see how the diagram is constructed.

https://drawio-app.com/extracting-the-xml-from-mxfiles/

You should be able to disable XML compression by setting <mxfile compressed="false" ...>.

So an approach could be:

  • Work on uncompressed .drawio xml files only.
  • Source control / diff / merge these files as human-readable text.
  • Add an svn/png conversion process when building the static documentation site.

(I have only tested part of this, let me know if it works.)