spatialaudio / nbsphinx

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

Can't show *.ipynb files rightly #595

Closed BAOOOOOM closed 2 years ago

BAOOOOOM commented 3 years ago

*.ipynb files can not be shown by nbsphinx. And show as this: image

Actually, if I use sphinx to build it locally, it can show in right format, just like this: image Thank you!

BAOOOOOM commented 3 years ago

Please click the link if you want to see the html which haven't show *.ipynb files rightly. https://edunlp.readthedocs.io/en/docs_dev/build/blitz/sif/sif.html

Thanks!

BAOOOOOM commented 3 years ago

I have used the method of #310, but the bug stills existence.

aulemahal commented 3 years ago

I had the same problem. Seems to have appeared with nbsphinx 0.8.7. I was able to build my docs correctly with sphinx 4.1.2 and nbsphinx 0.8.6.

The main change from 0.8.6 to 0.8.7, concerning this problem, is that the .ipynb extension is now added to sphinx's source suffixes ONLY if it is absent from the base config (the config as it is after executing conf.py). And it turns out I had this line in my conf.py:

source_suffix = [".rst", ".ipynb"]

Thus, nbsphinx was never registering notebooks to be parsed by the correct parser. Sphinx was reading them as if they were rst files. I am not sure why I add that line before, but removing the ipynb part solved my problem. @BAOOOOOM maybe you have something similar in your code?

BAOOOOOM commented 3 years ago

Yes, I have something similar in your code. Now the problem is sovled. Thank you very much.

mgeier commented 3 years ago
source_suffix = [".rst", ".ipynb"]

Using a list as source_suffix does not do what you expect, see https://www.sphinx-doc.org/en/master/usage/configuration.html#confval-source_suffix

Since .rst is Sphinx's default and .ipynb is automatically added by nbsphinx, setting source_suffix is not necessary at all.