ipolyglot
ipolyglot copied to clipboard
Add syntax highlighting to notebook cells for different languages.
Syntax highlighting is an important aspect of user experience. We want to introduce syntax highlighting in the notebook frontend for supported languages.
Syntax highlighting w/ the Jupyter project is handled on frontend side and uses the lexers provided w/ the pygment
library (http://pygments.org/docs/lexers). Which lexer is used for syntax highlighting is set in the Jupyter Kernel configuration, and consequently must be set at installation time:
'language_info': {
# Pygments lexer, for highlighting
# Only needed if it differs from the 'name'
'pygments_lexer': str,
...
}
(see https://jupyter-client.readthedocs.io/en/stable/messaging.html#msging-kernel-info)
Pygments provides a method called guess_lexer(code)
which might be useful for our case. However, it might not be compatible with how the API works.