Skip to content

embed images in svg to get diagrams displayed correctly #108

@mutax

Description

@mutax

When exporting to svg, embedded icons will still be referenced by remote URL and not be embedded into the svg.

With that parts of the svg will not be shown in and the exported svg will not display as expected when offline or the original source gets moved. In most cases browsers will refuse to load the referenced content.

In addition, when opening the svg, some software will request the images, e.g. inkscape, others like gimp or geeqie will not.

This could also be considered a privacy or security concern in some environments. When the documentation is meant for disaster recovery this can be especially problematic.

To Reproduce

  • embed a drawio diagram containing remote icons, e.g. via
    .. drawio-figure:: img/example.drawio
  • build the sphinx html export
  • open the html from a file-url
  • in this example: trees are missing from the diagram

This can also be reproduced manually:

drawio example.drawio -x -f svg --embed-svg-images -o embed.svg
drawio example.drawio -x -f svg  -o no-embed.svg
grep -c https://cdn0.iconfinder.com/ no-embed.svg
1

See screenshot below.

Expected behaviour
Diagrams embedded in a Sphinx html exports are displayed correctly when offline and do not create https requests to 'random' hosts on the Internet.

Screenshots
Image

Setup Information

  • OS: Linux Arch
  • Python: 3.13.7
  • Version: sphinxcontrib-drawio==0.0.17

Additional context

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions