spatialaudio / nbsphinx

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

Custom nbsphinx-gallery.css does not take into account - sphinx 7.2.6 #778

Closed ThibaultFy closed 3 months ago

ThibaultFy commented 9 months ago

Hello there,

When upgrading to Sphinx 7.2.6, my custom nbsphinx-gallery.css is not taken into account anymore (it is overwrite by a basic one).

I tried to explicitely add it to html_css_files -> same result.

Do you have any idea ?

Thanks !

mgeier commented 9 months ago

No, I have no idea, it sounds like a bug.

Can you bisect this?

ThibaultFy commented 9 months ago

Thanks for the quick answer.

Not much to bisect... I had the custom css nbsphinx-gallery.css working on a previous Sphinx version and nbsphinx 9.3 following doc requirements. But updgrading to Sphinx 7.2.6 broke it.

The conf.py is this one (pointing to the relevant line).

To give you an example, here the gallery with the custom CSS, and here with the bug.

mgeier commented 9 months ago

Not much to bisect...

Maybe we are using different interpretations of the term "bisect".

I wanted to suggest using git bisect. The result of this would be a single Git commit, which would be the one introducing the bug. With this, we can then ask the Sphinx team to fix it (or maybe it turns out to be something to be fixed in nbsphinx).

ThibaultFy commented 9 months ago

Oh okay sorry I didn't understood it this way. But which repo do you want me to bisect ? On my side, it is this one that introduced the bug, when bumping from Sphinx 4.4.0 to Sphinx 7.2.6.

ThibaultFy commented 9 months ago

I successfully fixed it by:

mgeier commented 8 months ago

It's great that you found a work-around, but this doesn't seem to be a real fix for the problem.

renaming the folder static to _static

You should be able to choose the folder name arbitrarily, you just have to use the same name in html_static_path.

add the css file to html_css_files var (e.g html_css_files = ["my-nbsphinx-gallery.css"]

If you use your own additional file name, you should do that, but if you want to overwrite an existing file name, you should not have to add it there.

the custom css can't be name nbsphinx-gallery.css anymore, or it is overwritten by the default one.

Yeah, but that's the bug, you should be able to overwrite it.

But which repo do you want me to bisect ?

https://github.com/sphinx-doc/sphinx/, because that's where we suspect the bug, right?

mgeier commented 8 months ago

I have bisected it and created https://github.com/sphinx-doc/sphinx/issues/12096.

mgeier commented 3 months ago

This has been fixed in https://github.com/sphinx-doc/sphinx/pull/12647 but it now creates a warning: https://github.com/sphinx-doc/sphinx/pull/12612. This should be available since Sphinx version 7.4.7.

To avoid the warning, I have created #808.

Can you please check if that works for you?