Skip to content
This repository has been archived by the owner on Mar 26, 2019. It is now read-only.

How do I add syntax highlighting to my own Jupyter kernel? #301

Open
HelgeCPH opened this issue Feb 20, 2018 · 1 comment
Open

How do I add syntax highlighting to my own Jupyter kernel? #301

HelgeCPH opened this issue Feb 20, 2018 · 1 comment

Comments

@HelgeCPH
Copy link

Hej all,

How do I add syntax highlighting to my own Jupyter kernel?

During the last week I worked on a Jupyter kernel for the Cypher Query Language, see https://github.com/HelgeCPH/cypher_kernel. I am in early stages but the kernel seems to work okay so far.

However, I cannot figure out how to add syntax highlighting to the code cells containing Cypher code. I added code completion of keywords by implementing the do_complete method but I cannot find anything related for syntax highlighting.

Are there examples for how to add syntax highlighting somewhere? Is there anything in the documentation that I could not find? Any help is appreciated.

@takluyver
Copy link
Member

Hi Helge,

Syntax highlighting is up to the frontend. For the notebook, there's a Javascript library called Codemirror, and happily it looks like it has a Cypher mode. I think if you set the language name to cypher on this line it should use that:

https://github.com/HelgeCPH/cypher_kernel/blob/c6c3dacf3dfaceec48abf8049e3d53d6d29077ae/cypher_kernel/kernel.py#L19

HelgeCPH pushed a commit to HelgeCPH/cypher_kernel that referenced this issue Feb 26, 2018
… Additionally, pulled bash and python shells to global static variables so that state can be shared accross commands. And I think I completed a magic for Python to convert query results to dataframes directly.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants