Working Javascript in HTML rendered notebooks

48 views
Skip to first unread message

Jason

unread,
Jan 13, 2019, 11:35:32 PM1/13/19
to Project Jupyter
Is there a way to ensure the javascript components work as per the actual notebooks when the ipynb file has been converted to html?

This seems to be possible from this GitHub directory: https://github.com/jupyter-widgets/ipywidgets/tree/master/examples/web3

How can I replicate this onto my own notebooks?


Roland Weber

unread,
Jan 15, 2019, 3:08:03 AM1/15/19
to Project Jupyter
Hello Jason,


Is there a way to ensure the javascript components work as per the actual notebooks when the ipynb file has been converted to html?

In general? No. JavaScript that relies on data stored in the notebook might work. JavaScript that tries to interact with the running kernel will fail, because there is no running kernel when you browse the html of a converted ipynb file.
 
This seems to be possible from this GitHub directory: https://github.com/jupyter-widgets/ipywidgets/tree/master/examples/web3

Instructions there explicitly mention that a notebook server must be running. This is not the case when you look at the html of a converted notebook. Iirc, ipywidgets/widgetsnbextensions have special logic that allows to render captured output even after conversion of the notebook to html. But you cannot expect the widgets to interact with the code in the kernel, as they do when you are running a notebook.

cheers,
  Roland

Chris Holdgraf

unread,
Jan 15, 2019, 11:07:50 AM1/15/19
to jup...@googlegroups.com
Though note that projects like thebelab (https://github.com/minrk/thebelab) are playing around with ways to back a static page with a kernel. 

Sent from my phone, apologies for the curtness and type-os

--
You received this message because you are subscribed to the Google Groups "Project Jupyter" group.
To unsubscribe from this group and stop receiving emails from it, send an email to jupyter+u...@googlegroups.com.
To post to this group, send email to jup...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/jupyter/18bfabee-f208-478d-88dc-344989fa4d8f%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Message has been deleted

Jason

unread,
Jan 15, 2019, 6:53:13 PM1/15/19
to Project Jupyter
Thanks for the fast replies!

Is is possible to hook the html to a live kernel so that the interactivity is maintained?

If so, how would I go about that?

Regards,

Jason

Jason Grout

unread,
Jan 16, 2019, 3:32:29 AM1/16/19
to Project Jupyter
Hooking an html page to a live kernel is exactly the sort of thing that ThebeLab, the project Chris mentioned, does: https://github.com/minrk/thebelab

Jason


--
You received this message because you are subscribed to the Google Groups "Project Jupyter" group.
To unsubscribe from this group and stop receiving emails from it, send an email to jupyter+u...@googlegroups.com.
To post to this group, send email to jup...@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages