From 547eefd55bbdbf957b508e64fbfc6978ba5edf97 Mon Sep 17 00:00:00 2001 From: mingrammer Date: Wed, 26 Feb 2020 00:25:34 +0900 Subject: [PATCH] feat: support inline rendering for jupyter notebook --- diagrams/__init__.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/diagrams/__init__.py b/diagrams/__init__.py index e240748c..5234c0c3 100644 --- a/diagrams/__init__.py +++ b/diagrams/__init__.py @@ -139,6 +139,9 @@ class Diagram: os.remove(self.filename) setdiagram(None) + def _repr_png_(self): + return self.dot.pipe(format='png') + def _validate_direction(self, direction: str) -> bool: direction = direction.upper() for v in self.__directions: