-
Notifications
You must be signed in to change notification settings - Fork 282
Chisel Highlighting
Jupyter uses CodeMirror for the text editing. Highlighting will have to take place in conjunction with that
Possible approaches
- Distributed modified ScalaHighlighter
- Easiest to implement, distributing can be hard.
- The file containing scala hints is
- libexec/lib/python2.7/site-packages/notebook/static/components/codemirror/mode/clike/clike.js
- Try to override codemirror highlighting
CodeMirror highlighting
According to CodeMirror Manual: cm.addOverlay(mode: string|object, ?options: object) Enable a highlighting overlay. This is a stateless mini-mode that can be used to add extra highlighting. For example, the search addon uses it to highlight the term that's currently being searched. mode can be a mode spec or a mode object (an object with a token method). The options parameter is optional. If given, it should be an object, optionally containing the following options:
opaque: bool Defaults to off, but can be given to allow the overlay styling, when not null, to override the styling of the base mode entirely, instead of the two being applied together.
priority: number Determines the ordering in which the overlays are applied. Those with high priority are applied after those with lower priority, and able to override the opaqueness of the ones that come before. Defaults to 0.
This sites a search highlighter found here search.js
An intriguing example is here, but it only applies to one editor. Perhaps it is necessary to apply.
Getting all cells
CELLS = Jupyter.notebook.get_cells();
for (var i = 0; i < CELLS.length; i++){
if(CELLS[i].cell_type == "code"){
CODE_CELL = CELLS[i];
break;
}
}