Ipywidgets: Syntax highlighting in TextArea widget

Created on 20 Aug 2017  路  6Comments  路  Source: jupyter-widgets/ipywidgets

I would love to be able to have syntax highlighting in the TextArea widget. I have a notebook where I'm asking users to write some code and manipulating the code with some python routines and showing the output.

Is there any way for me to enable syntax highlighting in the textarea widget ? Or is there some other widget I can use for this ? CodeMirrorWidget or so ?

Most helpful comment

I'd rather keep the core widget set smallish

To elaborate, I see the core widget set as basically providing wrappers around standard browser form controls.

All 6 comments

You'll need to write a custom widget using codemirror (or some other code editor). We use a standard html textarea in ipywidgets, which does not have syntax highlighting. That sounds like a great custom third-party widget!

You can use the widget cookie cutter to get started: https://github.com/jupyter-widgets/widget-cookiecutter

That sounds like a great custom third-party widget

It would definitely be great! Would this be something we want as a core widget?

I'd rather keep the core widget set smallish, and encourage a strong ecosystem of third-party widgets, especially at a time like this when the ecosystem needs to grow.

I'd rather keep the core widget set smallish

To elaborate, I see the core widget set as basically providing wrappers around standard browser form controls.

I'd rather keep the core widget set smallish, and encourage a strong ecosystem of third-party widgets, especially at a time like this when the ecosystem needs to grow

sounds like a good plan. (also means that should be more careful about breaking things).

Closing as answered.

Was this page helpful?
0 / 5 - 0 ratings