From fcfd16ac76b97cefd4f27afc8410f6c7c62ba0b2 Mon Sep 17 00:00:00 2001 From: Johannes Kasimir Date: Thu, 12 Oct 2023 14:24:07 +0200 Subject: [PATCH 1/2] fix: set default Jupyter mimetype text/html --- graphviz/jupyter_integration.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/graphviz/jupyter_integration.py b/graphviz/jupyter_integration.py index 9a7d136170..e57abc166b 100644 --- a/graphviz/jupyter_integration.py +++ b/graphviz/jupyter_integration.py @@ -14,15 +14,17 @@ JUPYTER_FORMATS = {'jpeg': _IMAGE_JPEG, 'jpg': _IMAGE_JPEG, 'png': 'image/png', - 'svg': 'image/svg+xml'} + 'svg': 'image/svg+xml', + 'html': 'text/html'} SUPPORTED_JUPYTER_FORMATS = set(JUPYTER_FORMATS) -DEFAULT_JUPYTER_FORMAT = next(_ for _ in SUPPORTED_JUPYTER_FORMATS if _ == 'svg') +DEFAULT_JUPYTER_FORMAT = next(_ for _ in SUPPORTED_JUPYTER_FORMATS if _ == 'html') MIME_TYPES = {'image/jpeg': '_repr_image_jpeg', 'image/png': '_repr_image_png', - 'image/svg+xml': '_repr_image_svg_xml'} + 'image/svg+xml': '_repr_image_svg_xml', + 'text/html': '_repr_image_svg_xml'} assert MIME_TYPES.keys() == set(JUPYTER_FORMATS.values()) From 7abda007fecac886eb862f443a01796c53cedb5e Mon Sep 17 00:00:00 2001 From: Johannes Kasimir Date: Thu, 12 Oct 2023 14:40:02 +0200 Subject: [PATCH 2/2] test: new default mimetype --- tests/test_init.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/test_init.py b/tests/test_init.py index 0b5e6997bd..82f952263b 100644 --- a/tests/test_init.py +++ b/tests/test_init.py @@ -6,9 +6,9 @@ DEFAULT_FORMAT = 'pdf' -DEFAULT_JUPYTER_FORMAT = 'svg' +DEFAULT_JUPYTER_FORMAT = 'html' -DEFAULT_JUPYTER_MIMETYPE = 'image/svg+xml' +DEFAULT_JUPYTER_MIMETYPE = 'text/html' def test_set_default_engine_invalid():