spatialaudio / nbsphinx

:ledger: Sphinx source parser for Jupyter notebooks
https://nbsphinx.readthedocs.io/
MIT License
451 stars 130 forks source link

Erroneous extra cells in singlehtml output #609

Open dokempf opened 2 years ago

dokempf commented 2 years ago

I am not sure whether nbsphinx intends to be compatible with both the html and singlehtml builders from Sphinx, but I realized that my singlehtml builds all produce a blank extra cell for each cell:

singlehtml

I tried fixing this with the various prompt-related configuration variables without success.

mgeier commented 2 years ago

I am not sure whether nbsphinx intends to be compatible with both the html and singlehtml builders from Sphinx

Good point, I'm not sure either.

But if it isn't too much hassle, why not!

BTW, the singlehtml mode is also used in the htmlzip output on RTD, see e.g. https://nbsphinx.readthedocs.io/_/downloads/en/latest/htmlzip/. This shows the same problem.

The problem at hand seems to be that nbsphinx's CSS modifications are not included at all in the singlehtml output.

It looks like the way 'nbsphinx_include_css' is assigned to and/or read from the document doesn't work in singlehtml mode.

Any ideas how to fix this?

mgeier commented 2 years ago

Here are the relevant places in the code:

https://github.com/spatialaudio/nbsphinx/blob/8bd255757ade0d072e5e13c9da706e002d6fa050/src/nbsphinx.py#L1088

https://github.com/spatialaudio/nbsphinx/blob/8bd255757ade0d072e5e13c9da706e002d6fa050/src/nbsphinx.py#L1994-L1995