On Saturday, March 10, 2018 at 8:26:21 PM UTC-6, Thomas Passin wrote:
> Run the code in Jupyter Notebook. Let it finish and display the graphic,
then save the notebook...
> ViewRendered will be able to show the graphic in the @jupyter node.
Many thanks for this. I had completely forgotten that the VR plugin
supports @jupyter nodes! Sheesh. gitk tells me I wrote this on 2017-01-05.
There is nothing in the docstring about @jupyter. Thomas, what do you
paste into the body text? A url, json or html? Anything you can add will
find it's way into the docstring.
Edward
P.S. For my reference, the update_jupyter method does the rendering: Here
is the guts of the code:
import nbformat
from nbconvert import HTMLExporter
from urllib.request import urlopen
...
url = g.getUrlFromNode(c.p)
if url and nbformat:
s = urlopen(url).read().decode()
try:
nb = nbformat.reads(s, as_version=4)
e = HTMLExporter()
(s, junk_resources) = e.from_notebook_node(nb)
except nbformat.reader.NotJSONError:
# Assume the result is html.
pass
elif url:
s = 'can not import nbformt: %r' % url
else:
s = g.u('')
w.setHtml(s)
Edward
--
You received this message because you are subscribed to the Google Groups
"leo-editor" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/leo-editor.
For more options, visit https://groups.google.com/d/optout.