imjoy-team / imjoy-jupyter-extension

Running ImJoy plugins in Jupyter notebooks
MIT License
11 stars 1 forks source link

Support syntax highlighting for imjoy plugins #4

Closed oeway closed 4 years ago

oeway commented 4 years ago

This PR adds support for syntax highlighting for ImJoy plugins. To enable it, add a comment in the first line ## ImJoy Plugin to the code contains html code for the plugin.

For example, in cell 1, do:

## ImJoy Plugin
from IPython.display import HTML
my_plugin_source = HTML('''

''')

in cell 2, you can use the plugin source code:

...
   # for regular plugin
   p = await api.getPlugin(my_plugin_source)

  # or for window plugin
  await api.createWindow(src=my_plugin_source)
  await api.showDialog(src=my_plugin_source)