Jupyter_contrib_nbextensions: nbconvert html_embed AND html_toc

Created on 22 Feb 2017  路  2Comments  路  Source: ipython-contrib/jupyter_contrib_nbextensions

Hi, great pleasure to benefit from html_embed (for figures) or fromhtml_toc (for toc :) through nbconvert ; thanks to their developers.

But how to convert to a html file with the 2 formats ?
Some option like nbconvert --to html_embed_toc ... ?

Apologies if the question is naive: I'm a newbie here.
PhL.

nbconvert

Most helpful comment

Unfortunately it is not possible to chain the two exporters; perhaps would it be possible if both were preprocessors.
Here the toc2 exporter essentially is a wrapper to using the toc2 template, while the embed_html seems essentially a post processor.

Given that, you should get both effects with
jupyter nbconvert --to html_embed --template toc2 FILE

Otherwise, if what you want/need is to keep image files in the html (html_toc extracts the image since the extractPostprocesor is enabled in toc2.py -- may not be a good idea after all), you can issue
jupyter nbconvert --to html_toc --ExtractOutputPreprocessor.enabled=False FILE

All 2 comments

Unfortunately it is not possible to chain the two exporters; perhaps would it be possible if both were preprocessors.
Here the toc2 exporter essentially is a wrapper to using the toc2 template, while the embed_html seems essentially a post processor.

Given that, you should get both effects with
jupyter nbconvert --to html_embed --template toc2 FILE

Otherwise, if what you want/need is to keep image files in the html (html_toc extracts the image since the extractPostprocesor is enabled in toc2.py -- may not be a good idea after all), you can issue
jupyter nbconvert --to html_toc --ExtractOutputPreprocessor.enabled=False FILE

jupyter nbconvert --to html_embed --template toc2 FILE

Right! It works fine: .ipynb file --> .html file with embed figures and toc numbers at every section level (+the classic toc). Perfect.

jupyter nbconvert --to html_toc --ExtractOutputPreprocessor.enabled=False FILE

No alas (?): figures in the generated html file are links to external files

Many thanks jfberger for your quick and fruitful answer. PhL.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

okdolly-001 picture okdolly-001  路  3Comments

rsemenoff picture rsemenoff  路  5Comments

Hgh2017 picture Hgh2017  路  3Comments

guerreroda picture guerreroda  路  5Comments

reedv picture reedv  路  6Comments