Sphinx Extension to add the drawio
directive to include draw.io diagrams.
Important: This extension is in development and not all features will work as advertised or at all.
The drawio-desktop package does not run without an x-server (e.g. when in a CI
environment), see
this issue.
The workaround is to install xvfb-run
and set the drawio_headless
config to True
.
python3 -m pip install sphinxcontrib-drawio
- In your sphinx config:
extensions = [
"sphinxcontrib.drawio"
]
- Add the binary to
$PATH
. For Windows addC:\Program Files\draw.io
and on Linux add/opt/draw.io/
. - (required for
drawio_headless
)sudo apt install xvfb
These are the available options and their default values.
drawio_output_format = "png" # from ["png", "jpg", "svg"]
drawio_binary_path = "/path/to/draw.io-binary"
drawio_headless = False
.. drawio:: example.drawio
:format: png
:alt: An Example
:align: center
:page-index: 0
If any other of the draw.io
CLI tool's options are wanted, please file an issue.