jupyter-sphinx icon indicating copy to clipboard operation
jupyter-sphinx copied to clipboard

Thebelab directive: Code highlighting not working properly?

Open martinRenou opened this issue 3 years ago • 2 comments
trafficstars

When using the Thebelab button to make the code cells executable, I don't seem to be able to have syntax highlighting working properly.

https://user-images.githubusercontent.com/21197331/146767224-674d819e-de06-44d6-9015-d83cd746a943.mp4

I tried with a dev install (master branch) of jupyter-sphinx, and it seems that data-language is being set to "ipython" here: https://github.com/jupyter/jupyter-sphinx/blob/28468f22ae8fb9d444ee3b11af04542e7427cb3c/jupyter_sphinx/thebelab.py#L23 This seems to be wrong and should be just "python", but even trying "python" locally does not work for me.

Do you have any pointers to how I could fix this? Could this be a Thebelab issue?


On another note, it looks like the font size changes when making the cells executable?

martinRenou avatar Dec 20 '21 12:12 martinRenou

I just realized there was a sphinx-thebe, where they seem to set the language to Python like this: https://github.com/executablebooks/sphinx-thebe/blob/master/sphinx_thebe/init.py#L109-L110

martinRenou avatar Dec 20 '21 12:12 martinRenou

I was able to get sphinx-thebe to work nicely with jupyter-sphinx, I commented on https://github.com/jupyter/jupyter-sphinx/issues/165 as it's going more in the direction of replacing the current thebe extension from jupyter-sphinx

martinRenou avatar Dec 20 '21 13:12 martinRenou