spatialaudio / nbsphinx

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

Provide option to specify a default fall back thumbnail #723

Closed HuangJunye closed 1 year ago

HuangJunye commented 1 year ago

Previously, it was possible to set a default fall back thumbnail by putting a no-image.png inside _static folder like here. However, this behaviour has changed since release 0.9. Is there a way to specify the fall back thumbnail that is not the standard "nbsphinx-no-thumbnail.svg" image?

Related to https://github.com/Qiskit/qiskit/issues/1707

mgeier commented 1 year ago

The mechanism for overriding the default image stayed the same, but I have indeed changed the file name including the suffix. So if you want to override the default, you now need to provide an SVG image at _static/nbsphinx-no-thumbnail.svg.

Alternatively, or if you want to use a different image format than SVG, you can use this in your conf.py:

nbsphinx_thumbnails = {
    '**': 'path/to/my-file.png',
}

See https://nbsphinx.readthedocs.io/en/0.9.1/gallery/thumbnail-from-conf-py.html.

HuangJunye commented 1 year ago

The mechanism for overriding the default image stayed the same, but I have indeed changed the file name including the suffix. So if you want to override the default, you now need to provide an SVG image at _static/nbsphinx-no-thumbnail.svg.

Alternatively, or if you want to use a different image format than SVG, you can use this in your conf.py:

nbsphinx_thumbnails = {
    '**': 'path/to/my-file.png',
}

See https://nbsphinx.readthedocs.io/en/0.9.1/gallery/thumbnail-from-conf-py.html.

Thanks for the response! I am going to try that.

HuangJunye commented 1 year ago

I am going with the conf.py approach because I want to use png file. It's working well. Thanks for the tips! https://github.com/Qiskit/qiskit/pull/1708