jupyterlab-myst: Inline YouTubeVideos don't render when notebook is not `trusted`

Describe the bug

context In IPython.display we have a built-in YouTubeVideo object that’s very handy.

For example, this code

from IPython.display import YouTubeVideo
YouTubeVideo('NxSNVt9XsCI')

produces an embedded video

image

expectation This should also work in our mardkown cells…

bug Nothing is rendered. I’ve marked it in the inline example notebook, which we can update once this is fixed.

Reproduce the bug

See above.

List your environment

No response

About this issue

  • Original URL
  • State: closed
  • Created a year ago
  • Comments: 17 (14 by maintainers)

Most upvoted comments

🤦 ^ 💯

NVM, I’ll go teach a class instead 😉

I think that #119 should have fixed this: we are now more closely following the security model laid out by Jupyter – don’t render things until explicit permission by the user. Or you set the whole notebook to be trusted.

This means that the youtube (untrusted) won’t render in the markdown unless you explicitly “execute” the markdown cell.

There are a few weird differences still on what is trusted and not, but I think that this issue specifically can be closed, and we can open new ones … !

@fperez I am no longer seeing that long delay in rendering, really not sure if we did something there. Can always reopen a new issue specifically for that if that shows up again!

We will aim to release this this week with a lot of other quality of life fixes.

This is on binder… And about 30s later, it reappeared! No idea why… I’ll leave figuring that out to you folks 😃

I meant to test the code in the markdown that had ytlink to also embed an actual video, I tested that at first and it didn’t work, and after the fix I forgot to change it again…

More ☕ for this table, please.

@rowanc1 jinx 😉

It’s working for me:

  • <kbd>Ctrl</kbd> + <kbd>Shift</kbd> + <kbd>C</kbd>
  • Type "Trust Notebook"
  • Execute the command
  • Restart & run all cells

Thanks @fperez. I did just fix a bug here which may be related:

That is not yet picked up in v1.1.0.

Some of the inline renderers also have zero height (e.g. altair), so we may need to do more CSS work here.