I have a built a package to compile and run C/C++ and FORTRAN sources in a jupyter notebook cell using custom cell magics.
The cell magics are %%CPP %%C and %%FORTRAN.
I can’t seem to get proper syntax highlighting for the cell magics in JupyterLab. This code enables syntax highlighting for ordinary Jupyter notebooks if I put it in ~/.jupyter/custom/custom.js
For dynamic changes of mode depending on cell content, like the use of %%CPP magic, jupyterlab-lsp is one option. Or you could write an extension which re-uses the relevant bits of jupyterlab-lsp. Or we could make it into standalone extension within LSP to let users install it as it seems a common question.
Good suggestions, I’m still not sure how to proceed but it seems that this use case is pretty common and could go into a feature request. All that we need is a way to apply CodeCell’s syntax highlighting for any of its supported languages to any cell magic of our choosing.
Yes, I forgot to mention the LSP path, which is becoming increasingly viable. I’d personally also be happy to help in getting more (open source) language servers packaged on conda-forge, as that’s where we draw our test dependencies (if possible) for jupyter-lsp.
Any news about an easy way to do it? I want support for the iTikZ magic extension: iTikZ GitHub Repository. TikZ is essentially LaTeX images (text/x-stex acorrding to CodeMirror: sTeX mode).
EDITED:
I found an easier solution to add support to highlight a custom magic cell that uses an existing language server in jupyterlab-lsp. The example below extending latex syntax.