spatialaudio / nbsphinx

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

Suppress warnings for unknown MIME types? #811

Open arafune opened 3 months ago

arafune commented 3 months ago

I use nbsphinx to build pdf file from the ipynb that uses "holoviews".

When I run the cell on the web browser no problem happens. And the logo icons of holoviews (https://holoviews.org) and bokeh (https://bokeh.org) like below.

スクリーンショット 2024-08-18 17 00 19

On the other hand, in the pdf file these icons don't appear. Instead, the warning message appears as follows.

スクリーンショット 2024-08-18 17 02 10

My request is to create a function to suppress this message.

If such feature has been already introduced, let me know the way.

Bests,

mgeier commented 3 months ago

Such an option does not exist yet, but it should not be too hard to add. This is where the message is generated:

https://github.com/spatialaudio/nbsphinx/blob/ae3c9d9bbf56b6afe5f102f62cd14dfb44e76011/src/nbsphinx/__init__.py#L211-L213

A new Jinja variable could be added and checked with elif instead of else.

arafune commented 3 months ago

Thank you for your comment. I'm glad to hear that the implementation process won't be too difficult.

I look forward to seeing it implemented soon.

mgeier commented 3 months ago

I look forward to seeing it implemented soon.

I'm not planning to implement that.

If you need that feature, the quickest way is probably to implement it yourself. I'm happy to help if you encounter any problems.

But now that I'm looking at it again, I'm wondering if there isn't a way to fix this from the holoviews/bokeh side?

They could add a text/plain MIME type to the output of their icons, containing a message like "plotting not supported" or something. This way, nbsphinx wouldn't create a warning message.