Description
Describe the bug
When using jupyter-book to convert a jupyter notebook with ipywidgets tabs, the tabs are removed in the final html document.
To Reproduce
Steps to reproduce the behavior:
- Run this code in a jupyter notebook cell: (or download the attached notebook)
from ipywidgets import widgets
from IPython.display import display
from plotnine import ggplot, aes, geom_bar
from plotnine.data import mpg
conditions = ["class", "drv", "manufacturer"]
tabs_outputs = list()
for current_condition in conditions:
out = widgets.Output(layout={'border': '1px solid black'})
with out:
p = ggplot(mpg) + \
geom_bar(aes(x=current_condition))
display(p)
tabs_outputs.append(out)
tab = widgets.Tab()
tab.children = tabs_outputs
for indx in range(len(conditions)):
tab.set_title(indx, "Condition " + chr(ord("A") + indx))
tab
- run:
jupyter-book page ipywidget_tab.ipynb
- open in the browser _build/html/ipywidget_tab.html
- See error
Expected behavior
When I do the same thing using nbconvert I do see the tabs:
jupyter nbconvert ipywidget_tab.ipynb
But when using jupyter-book the plots appear one after the other but no tabs:
An extra question I have is how can I get rid of the printing of the repr of the ggplot object (red arrow). When using nbconvert I can use a custom jinja2 template where I override {% block stream_stdout %} to get rid of it. How to achieve the same in jupyter-book? also, I need many times to override {% block stream_stderr %} to get rid of warnings in the final report, how to do that? maybe there is a cell tag I can append to do so similar to remove-input etc? (I can do a new issue for this if appropiate)
A link to your book's repository.
Not in a public repo, but attaching here the jupyter notebook and the html directory inside _build. Attaching a text file with the output from running jupyter-book page.
Environment (please complete the following information):
- Python Version 3.7.6
- Output of
jupyter-book --version
Jupyter Book: 0.7.0b5dev0
MyST-NB: 0.8.1
Sphinx Book Theme: 0.0.20
MyST-Parser: 0.8.1
Jupyter-Cache: 0.2.2
Additional context
The example is obviously a minimal one, in a real setting I have lots of plots with typically two nested levels of tabs.
Another thing I have noticed (can create another issue if needed) is that objects of type IPython.display.Markdown are also not rendered correctly, so maybe it is an issue with IPython.display in general?
Activity