Open tverbeiren opened 11 months ago
Yes, that's a known limitation of the graphviz library we use (which is a webassembly compilation), and unfortunately there's nothing we can do about that.
I see.
I think this is related: https://github.com/hpcc-systems/hpcc-js-wasm/issues/145
That's exactly right, but we'll leave this open in case someone else writes a graphviz
port that does the right thing. It's "merely" very hard as opposed to impossible.
There is an easy workaround in case you have a local installation of graphviz on your computer.
Instead of letting quarto render the diagram you can delegate this to the command line in a code chunk and include the resulting svg in your document. You have to use the -Tsvg:cairo:cairo
renderer of graphviz as -Tsvg
defaults to the svg:svg:core
renderer which produces weird svg files not compatible with most image readers and quarto. Of course you can replace dot by neato, osage ...
I'm on a linux system. If you are using Windows or a Mac your command line will have to be modified.
``` {python}
!dot -Tsvg:cairo:cairo [PathToFile]/graphviz-diagram.gv > [PathToFile]/rendered-svg-image.svg
I don't know how quarto uses its internal graphviz library, but maybe the `-Tsvg:cairo:cairo` is also possible as an interim solution?
HTH Guenther
Bug description
Graphviz supports using an image (for instance a .png image file) as a node background (
image
attribute) or in HTML labels. In both cases, the SVG rendered by the dot engine in Quarto removes the image.Steps to reproduce
Please see https://github.com/tverbeiren/quarto-graphviz/tree/quarto-issue for an example Quarto document. The
comp.png
file is added both as a node attribute and inside the HTMLIMG
. Both the quarto versions and thedot
CLI versions are available in thegraphviz.qmd
and resultinggraphviz.html
files.Expected behavior
The expected behavior is the one generated by the
dot
CLI tool. Please see repo branch for more information.Actual behavior
The images are stripped from the generated SVGs by Quarto. Please refer to the repository for more information.
Your environment
MacOS Ventura 13.4
Quarto check output