vatlab / sos-notebook

Multi-language Jupyter Notebook
http://vatlab.github.io/SoS
BSD 3-Clause "New" or "Revised" License
176 stars 17 forks source link

Syntax highlighting does not work with some kernels #321

Closed fortierq closed 3 years ago

fortierq commented 3 years ago

I want to use sos-notebook to have multiple kernels in the same notebook (I don't need to exchange data between kernels). I added a C++ and an OCaml kernel for Jupyter but, when used with SoS, the syntax highlighting is not working for these languages: sos How can I use the correct syntax highlighting (it works when I use only one kernel, without SoS)?

For information, the Dockerfile I am using: https://github.com/fortierq/mp2i-jupyter-docker/blob/master/Dockerfile

BoPeng commented 3 years ago

This is because there are too many codemirrow modes and sos by default only include some of the common ones. I can either add c mode, or figure out some way to make it configurable.

BoPeng commented 3 years ago

https://github.com/vatlab/sos-notebook/blob/c581da1b8a48cd48489d8ad2a18af86a9ea57bde/src/sos_notebook/kernel.js#L7-L25

are the modes that are loaded by default. I guess I need some JS guru to show me how to load them dynamically.

BoPeng commented 3 years ago

I pushed a patch to the cpp branch without testing it. Please let me know if it works for you after

  1. check out the cpp branch
  2. run pip install -e . under the source directory
  3. run python -m sos_notebook.install and restart jupyter.
fortierq commented 3 years ago

Thank you! I think mllike should be used instead of ocaml for codemirror (see my PR). This is working except for #include (clashing with python comment I guess?). cpp

BoPeng commented 3 years ago

Thanks. I have merged your PR and released sos-notebook 0.22.6.