render `ipywidgets.HTML()`
If a python notebook cell contains e.g. display(ipywidgets.HTML("<span>Hello</span>")), ideally nbsphinx should keep the raw HTML. Is there any other way a python code cell (not markdown cell) can use raw HTML?
What do you mean by "keep the raw HTML"?
When I run the given code, the formatted text "Hello" is displayed, the <span> markup is not visible (but is taken into account by the browser).
When I do the same with nbsphinx, the output is the same.
Is there any other way a python code cell (not markdown cell) can use raw HTML?
from IPython.display import HTML
display(HTML("<span>Hello</span>"))
This produces a very similar result, but it doesn't need the widgets machinery.
Intriguing... display(IPython.display.HTML("<span>Hello</span>")) works but display(ipywidgets.HTML("<span>Hello</span>")) gets stripped by nbsphinx.
In both cases saving & reopening the notebook works as expected; it just seems that nbsphinx removes ipywidgets upon conversion.
I can't reproduce anything getting stripped by nbsphinx.
Do other Jupyter widgets work with nbsphinx?
You can use this notebook for testing: https://nbsphinx.readthedocs.io/en/0.8.3/code-cells.html#Interactive-Widgets-(HTML-only).
If it doesn't work, you should have a look at https://nbsphinx.readthedocs.io/en/0.8.3/code-cells.html#Troubleshooting.