Did you know that you can navigate the posts by swiping left and right?

JupyterLab Metadata Extension for JupyterLab 4.x

22 Nov 2024 . Category . Comments #research #education-research #datawhys #data-science #machine-learning #programming #statistics

A JupyterLab extension that uses cell metadata to inject html/javacript into JupyterLab, for JupyterLab 4.x.

We originally created this extension for JupyterLab 1.2.x, but that extension no longer worked with JupyterLab 4.x, so we have upgraded it.

It is extremely useful for playing videos in JupyterLab, though it has many uses.

This approach overcomes the limitations of JupyterLab markdown cells for certain types of html, such as iframes, that appear to be stripped/sanitized based on the JupyterLab security model.

Using this extension therefore increases the likelihood that an attacker may use a notebook to execute arbitrary code on your computer.

This extension is meant for research purposes only and is not meant for general usage.

Obviously, notebooks with html in the metadata will not render properly without this extension.

Example metadata:

{
    "html": "<iframe class='metadata-html' width='560' height='315' src='https://www.youtube.com/embed/nBrKsT1IvIM' frameborder='0' allow='accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture' allowfullscreen></iframe>"
}

class='metadata-html' will prevent duplicate html injection if switching between notebooks.