[IPython-dev] What's the easiest way to render an .ipynb file as html?
doug.blank at gmail.com
Wed Aug 27 13:25:45 EDT 2014
Great, thanks! That gets me very close to being complete... need to make
sure I get the css to load. (I'm adding a method to dynamically create a
static version of a live, shared notebook in the new multiuser server ).
 - https://github.com/jupyter/jupyterhub
On Wed, Aug 27, 2014 at 12:54 PM, Jacob Vanderplas <
jakevdp at cs.washington.edu> wrote:
> Here's an example of a possible approach:
> from IPython.nbformat import current as nbformat
> from IPython.nbconvert.exporters import HTMLExporter
> input_file = 'notebook.ipynb'
> output_file = 'notebook.html'
> with open(input_file) as f:
> notebook_content = f.read()
> exporter = HTMLExporter(template_file='full')
> nb_json = nbformat.reads_json(notebook_content)
> (body, resources) = exporter.from_notebook_node(nb_json)
> with open(output_file, 'w') as f:
> Hope that helps!
> Jake VanderPlas
> Director of Research – Physical Sciences
> eScience Institute, University of Washington
> On Wed, Aug 27, 2014 at 9:24 AM, Doug Blank <doug.blank at gmail.com> wrote:
>> Short of calling nbviewer, what is the easiest way to render a local
>> .ipynb file as html, just like nbviewer does? Would prefer to use the
>> IPython libraries directly rather than externally calling ipython, but that
>> would work too.
>> IPython-dev mailing list
>> IPython-dev at scipy.org
> IPython-dev mailing list
> IPython-dev at scipy.org
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the IPython-dev