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

Matthias Bussonnier bussonniermatthias at gmail.com
Wed Aug 19 05:11:59 EDT 2015


Hi Robert,

Once your highlighting mode in in the right place in the codemirror
directory (notebook/components/codemirror/mode/modename/modefile.js
IIRC) 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.

Otherwise you can explicitely set the mode.
See http://jupyter-client.readthedocs.org/en/latest/messaging.html#kernel-info

If you can point us to where your mode is, and where your kernel is we
can help you to figure that out.
-- 
m


On Wed, Aug 19, 2015 at 2:37 AM, Robert Dodier <robert.dodier at gmail.com> wrote:
> Hi Thomas, hi everyone,
>
>> Codemirror is the JS text editor we use for notebook cells. Many
>> kernels can just specify one of the modes codemirror already
>> provides: https://codemirror.net/mode/
>>
>> If there isn't a suitable mode already in codemirror (it doesn't look
>> like there's one for Maxima), you'll need to provide one.
>
> I have createdd a mode for Maxima by modifying one of the existing modes,
> but it doesn't seem to be activated -- stuff is shown without highlighting.
> I'm expecting that stuff I type into an input cell will be colorized --
> that's the way it is supposed to work, right?
>
> How is IPython supposed to activate or trigger CodeMirror?
> Perhaps I'm missing something very obvious. I tried copying the
> CodeMirror-related stuff from Fishbowl (the project from which I
> forked Maxima-Fishbowl) but nothing happens. What I'm not
> understanding is, what is the magic in IPython which causes
> CodeMirror to be applied to stuff. Thanks in advance for any
> light you can shed on this question.
>
> best,
>
> Robert Dodier
> _______________________________________________
> IPython-dev mailing list
> IPython-dev at scipy.org
> http://mail.scipy.org/mailman/listinfo/ipython-dev



More information about the IPython-dev mailing list