ipolyglot icon indicating copy to clipboard operation
ipolyglot copied to clipboard

Add syntax highlighting to notebook cells for different languages.

Open niconomaa opened this issue 5 years ago • 1 comments

Syntax highlighting is an important aspect of user experience. We want to introduce syntax highlighting in the notebook frontend for supported languages.

niconomaa avatar Apr 23 '19 13:04 niconomaa

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.

jonashering avatar Jun 17 '19 20:06 jonashering