Hi,
Im currently trying to save all figures from notebooks without opening them into lab/hub in order to get a “thumbnail” of my notebooks.
For matplotlib figure, it is pretty straight forward :
i use :
rst_exporter = RSTExporter() #
(_, resources) = rst_exporter.from_notebook_node(myNb)
But for holoview/bokeh, it is a bit more tricky
i tried to use HTMLExporter with selecting the figure cell. But then nothing appears in the html file
So i also included the cell with the holoview import like this :
html_exporter_with_figs = HTMLExporter()
html_exporter_with_figs.preprocessors
nb = nbformat.read("ExempleBokeh.ipynb", as_version=4)
nb.cells=nb.cells[1:2]+nb.cells[6:8]
#print(nb.cells[0])
(s, resources_with_fig) = html_exporter_with_figs.from_notebook_node(nb)
#print(resources_with_fig)
with open("test2.html","w") as file:
file.write(str(s))
it is working, i got my holoview figure correctly displayed. But i also got all the cell decoration, code … etc … like a classic notebook. By hand, i can remove all the “div” i dont want, but i think there is a better solution.
What i would like is ONLY the figure :
Is there example somewhere of preprocessor or postprocessor to “convert” into html div only the output ?