jupyter / jupyter-sphinx

Sphinx extension for rendering of Jupyter interactive widgets.
https://jupyter-sphinx.readthedocs.io/
BSD 3-Clause "New" or "Revised" License
186 stars 65 forks source link

Thebelab directive: Code highlighting not working properly? #191

Open martinRenou opened 2 years ago

martinRenou commented 2 years ago

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 commented 2 years ago

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 commented 2 years ago

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