[IPython-dev] how to implement syntax highlighting for a new language

Robert Dodier robert.dodier at gmail.com
Wed Aug 19 19:30:35 EDT 2015


On Wed, Aug 19, 2015 at 2:11 AM, Matthias Bussonnier
<bussonniermatthias at gmail.com> wrote:

> Once your highlighting mode in in the right place in the codemirror
> directory (notebook/components/codemirror/mode/modename/modefile.js
> IIRC)

I can't seem to get this to work for me. I'm getting a 404 for
maxima.js no matter where I put it, e.g.:

[W 16:16:10.332 NotebookApp] 404 GET
/static/components/codemirror/mode/maxima/maxima.js?v=20150819161553
(127.0.0.1) 1.66ms
referer=http://localhost:8889/notebooks/Untitled13.ipynb?kernel_name=maxima

I have tried putting maxima.js in the system-wide installation directory
for CodeMirror (and putting Maxima on the list in codemirror/mode/meta.js
for good measure), and also putting maxima.js into
 ~/.ipython/profile_default/static/components/codemirror/mode/maxima/.

Is there a way to query the notebook server to find out what
its document root is? With an older version of IPython (namely 2.x)
that I was working with, it appeared that the document root was
 ~/.ipython/profile_something/, but that doesn't seem to be the
case anymore. From where is the notebook server trying to
load static/something?

How is the profile selected, by the way? and does it matter that
it is in a directory named ~/.ipython instead of ~/.jupyter?
I find ~/.jupyter is empty except for a file named "migrated".

> you need your kernel-info-reply to give the name of the
> codemirror mode is one of the field. Most of the time the language
> name is enough, codemirror has a mapping Language<->mode.

I think this part is working as expected -- the Maxima kernel puts
"maxima" as the language-info-name and then Jupyter tries to
load maxima.js as I hoped it would.

Thank you very much for your help, I appreciate it.

best,

Robert Dodier



More information about the IPython-dev mailing list