graphviz icon indicating copy to clipboard operation
graphviz copied to clipboard

fix: set default Jupyter mimetype text/html

Open jokasimr opened this issue 1 year ago • 3 comments

The default mime-type in the Jupyter integration is currently image/svg+xml. This makes Jupyter display the generated svg in an <img> tag. The issue with that is we lose some nice features of svg such as being able to select text (labels on nodes etc).

If we use the mime type text/html Jupyter displays an <svg> node instead.

Example Screenshot from 2023-10-12 14-41-32

jokasimr avatar Oct 12 '23 12:10 jokasimr

Codecov Report

Merging #205 (7abda00) into master (1760930) will not change coverage. The diff coverage is 100.00%.

:exclamation: Your organization needs to install the Codecov GitHub app to enable full functionality.

@@            Coverage Diff            @@
##            master      #205   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files           33        33           
  Lines         1085      1085           
=========================================
  Hits          1085      1085           
Files Coverage Δ
graphviz/jupyter_integration.py 100.00% <100.00%> (ø)

:mega: We’re building smart automated test selection to slash your CI/CD build times. Learn more

codecov-commenter avatar Oct 12 '23 12:10 codecov-commenter

Thanks for the PR.

The issue with that is we lose some nice features of svg such as being able to select text (labels on nodes etc).

Cannot reproduce, text selection works as intended for me both under nbviewer and the GH renderer.

Screenshot 2023-10-16 190734

Screenshot 2023-10-16 190848

Maybe this is specific to your browser (used Firefox above)?

xflr6 avatar Oct 16 '23 17:10 xflr6

Cannot reproduce, text selection works as intended for me both under nbviewer and the GH renderer.

Interesting, I've tested the following combinations: Jupyter Lab in Firefox and Chrome, Sphinx documentation in Firefox and Chrome.

In those cases the graph visualizations were rendered as <img>. Another example are the graphs displayed in the graphviz docs.

jokasimr avatar Oct 17 '23 09:10 jokasimr