Add repr-html to nbscreenshot
+import base64
from io import BytesIO
__all__ = ['nbscreenshot']
@@ -69,5 +70,11 @@ class NotebookScreenshot:
png = file_obj.read()
return png
+ def _repr_html_(self):
+ png = self._repr_png_()
+ url = 'data:image/png;base64,' + base64.b64encode(png).decode('utf-8')
+ html = f'<img src="{url}"></img>'
+ return html
+
nbscreenshot = NotebookScreenshot
