I made a simple syntax highlighting extension for Jupyterlab 3 using the ICodeMirror
token however now that Jupyterlab 4 has come out, it seems that the ICodeMirror
token has been removed and replaced with a more formal interface with the IEditorLanguageRegistry
token. Are there any examples or explanations on how to use this interface to create a syntax highlighter for code?
In my older extension for Jupyterlab 3 I made use of CodeMirror.defineMode
, CodeMirror.defineMIME
and CodeMirror.modeInfo
which all seem to be removed from the new interface.
My code is available at Jason Nagy / unicode-snippets-ts · GitLab under src/syntaxhilighter.ts
and src/algorithm.ts
.
It seems like I need to create an object of type IEditorLanguage
but I am not sure how I need to do this. Looking at examples for jupyter-lsp, they seem to use an extension factory which is hard to parse and overkill for my simple language. Similarly I tried to read through the robotmode syntax highlighter at jupyterlab_robotmode/src/mode.ts at 315703af261b9776f962740ee1523e0bc4986ed9 · bollwyvl/jupyterlab_robotmode · GitHub but I am having difficulty understanding what is happening.