You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am trying to export html with base64 images as separate files (to import to wordpress blog). Below is code I am trying as per suggestion here. The 'ouptuts' dictionary is simply empty with no png files.
# from urllib.request import urlopen
from nbconvert import HTMLExporter
from traitlets.config import Config
import nbformat
# Load file
contentString = open('test.ipynb').read()
jake_notebook = nbformat.reads(contentString, as_version=4)
# Default HTML exporter
html_exporter = HTMLExporter()
html_exporter.template_file = 'basic'
# print("Resources:", resources.keys())
# print("Metadata:", resources['metadata'].keys())
# print("Inlining:", resources['inlining'].keys())
# print("Extension:", resources['output_extension'])
# HTML exporter with figures
c = Config()
c.HTMLExporter.preprocessors = ['nbconvert.preprocessors.ExtractOutputPreprocessor']
html_exporter_with_figs = HTMLExporter(config=c)
html_exporter_with_figs.preprocessors
(_, resources) = html_exporter.from_notebook_node(jake_notebook)
(_, resources_with_fig) = html_exporter_with_figs.from_notebook_node(jake_notebook)
print("resources without figures:")
print(sorted(resources.keys()))
print("\nresources with extracted figures (notice that there's one more field called 'outputs'):")
print(sorted(resources_with_fig.keys()))
print("\nthe actual figures are:")
print(sorted(resources_with_fig['outputs'].keys()))
Kindly help. Here is the gist (please check raw, as gist does not seem to decode base64 inline image)
The text was updated successfully, but these errors were encountered:
ExtractOutputPreprocessor only extracts outputs, not attachments in markdown cells. I think someone was investigating extracting attachments in another issue thread.
Hi
I am trying to export html with base64 images as separate files (to import to wordpress blog). Below is code I am trying as per suggestion here. The 'ouptuts' dictionary is simply empty with no png files.
Kindly help. Here is the gist (please check raw, as gist does not seem to decode base64 inline image)
The text was updated successfully, but these errors were encountered: