Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: set default Jupyter mimetype text/html #205

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

jokasimr
Copy link

@jokasimr jokasimr commented Oct 12, 2023

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

@codecov-commenter
Copy link

codecov-commenter commented Oct 12, 2023

Codecov Report

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

❗ 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%> (ø)

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

@xflr6
Copy link
Owner

xflr6 commented Oct 16, 2023

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)?

@jokasimr
Copy link
Author

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants