How to use rendered JS as/acting on a notebook cell?

For context: I want to make an extension that adds a WYSIWYG CAS to Jupyter, just by really quickly slapping together MathQuill and SymPy using latex2sympy as an intermediary.

It should be a really quick and dirty thing, but I’m stuck on how to actually USE MathQuill in a notebook. It’s written in JS which should be fairly straightforward to use, but with Google being how it is nowadays it’s really difficult to find directions on how to do it.

MathQuill takes in a document element and converts it to an equation editor, so I don’t need to somehow inject a specific class, but I just need to figure out how to actually connect it to a notebook cell.

How do you reference notebook cells as a document element?

I can’t give a definite answer,
however I recently built a widget (typescript for frontend) and
bound it to python class,
which intern is exported through the init.py file.
(Checkout ‘custom email example with ipywidgets’ )

Now in the actual cell, I imported this python class and ran it. This displays the widget in the cell output.

Hope it helps