jupyter / nbconvert

Jupyter Notebook Conversion
https://nbconvert.readthedocs.io/
BSD 3-Clause "New" or "Revised" License
1.75k stars 569 forks source link

HTML Export with Embedded Images in Base64 #634

Open gabyx opened 7 years ago

gabyx commented 7 years ago

Would it be hard to write an export function which exports the HTML but embeds every image in Base64 encoding? I would contribute that, but need some starting points

Can anybody give me some starting point on what to extent, it might be easier :-) Is there already such an exportet available somewhere? Ist it a template I have to write or rather a preprocessor ??

juhasch commented 7 years ago

Take a look at the exporters in ipython-contrib: http://jupyter-contrib-nbextensions.readthedocs.io/en/latest/exporting.html

gabyx commented 7 years ago

Thanks, the question arose, when nbconvert.exporters.export_locater from the browser) will no more be used in jupyter (deprecated, but used when exporting with javascript Jupyter.menubar._nbconvert('html_embed', true);)

Only then my Embedded HTML export button works in : https://github.com/gabyx/jupyter_contrib_nbextensions/blob/master/src/jupyter_contrib_nbextensions/nbextensions/export_embedded/main.js -> see htmlembedded string which is enabled by my fork of nbconvert where I hardcoded the exporter in to the list (hopefully no more needed in the future) ;-)

mpacer commented 7 years ago

I think your issue is that you may have not declared an exporter with an entrypoint that allows it to be found. If you just make package your exporter with an entrypoint you should have no difficulty using the standard nbconvert machinery. This use case is basically the reason for which we introduced exporter entrypoints.

mpacer commented 7 years ago

exporter_locator is not used in modern versions of the notebook's backend nbconvert handlers, but get_exporter is and it is used via that JavaScript call which hits the nbconvert handler.

gabyx commented 7 years ago

I have defined my exporter with an entry_point, since I forked from jupyter_contrib_extensions I added it in the setup and on the cmd line it works perfectly, but in the notebook it does not, jupyter 4.3.0, probably an issue for the notebook?

gabyx commented 7 years ago

https://github.com/jupyter/notebook/pull/2706