nbsphinx icon indicating copy to clipboard operation
nbsphinx copied to clipboard

Suppress warnings for unknown MIME types?

Open arafune opened this issue 1 year ago • 3 comments

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,

arafune avatar Aug 18 '24 08:08 arafune

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.

mgeier avatar Aug 18 '24 08:08 mgeier

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.

arafune avatar Aug 19 '24 00:08 arafune

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.

mgeier avatar Aug 24 '24 09:08 mgeier