How to inject languages into Jupyter Notebooks (> 2019.3)?
Answered
It seems the new Jupyter Notebook (2019.3) is not implemented via language injection mechanisms. All PSI elements found by PsiViewer are not injectable. However, the ``` ``` sections in markdown cells seem to work normally.
What language injection technics are used in the new Jupyter Notebook? If we want to inject new languages into it, how to implement it?
Please sign in to leave a comment.
Could you please elaborate a bit? Which languages do you want to inject and why?
I want to inject Tex language (with the Texify IDEA plugin) into markdown files to leverage syntax highlighting and auto completions.
For example:
-----
This is a **normal** markdown file containing a latex equation $a = b$
-----
I want to enable Tex language syntax highlighting between to two dollar symbols.
After I published the post, I found some clues. In the Jupyter notebook, markdown cells are implemented as Lazy Parsables and the cells will be parsed by the Markdown language plugin. So I created an issue on youtrack to ask JB devs to implement PSILanguageInjectionHost in the MarkdownParagraphImpl class.
Thank you for the explanation and for the ticket! This should do the trick.