config.js
64 lines
| 2.0 KiB
| application/javascript
|
JavascriptLexer
Jonathan Frederic
|
r17200 | // Copyright (c) IPython Development Team. | ||
// Distributed under the terms of the Modified BSD License. | ||||
Matthias BUSSONNIER
|
r8202 | |||
Matthias BUSSONNIER
|
r18280 | /** | ||
* | ||||
* | ||||
* @module config | ||||
* @namespace config | ||||
* @class Config | ||||
*/ | ||||
Jonathan Frederic
|
r17200 | define([], function() { | ||
Matthias BUSSONNIER
|
r12103 | "use strict"; | ||
Jonathan Frederic
|
r17200 | |||
Bussonnier Matthias
|
r8949 | var default_config = { | ||
Matthias BUSSONNIER
|
r8739 | /** | ||
* Dictionary of object to autodetect highlight mode for code cell. | ||||
* Item of the dictionnary should take the form : | ||||
* | ||||
* key : {'reg':[list_of_regexp]} | ||||
* | ||||
* where `key` will be the code mirror mode name | ||||
* and `list_of_regexp` should be a list of regext that should match | ||||
* the first line of the cell to trigger this mode. | ||||
* | ||||
* if `key` is prefixed by the `magic_` prefix the codemirror `mode` | ||||
* will be applied only at the end of the first line | ||||
* | ||||
* @attribute cell_magic_highlight | ||||
* @example | ||||
* This would trigger javascript mode | ||||
* from the second line if first line start with `%%javascript` or `%%jsmagic` | ||||
* | ||||
* cell_magic_highlight['magic_javascript'] = {'reg':[/^%%javascript/,/^%%jsmagic/]} | ||||
* @example | ||||
* This would trigger javascript mode | ||||
* from the second line if first line start with `var` | ||||
* | ||||
* cell_magic_highlight['javascript'] = {'reg':[/^var/]} | ||||
*/ | ||||
Matthias BUSSONNIER
|
r8202 | cell_magic_highlight : { | ||
Jonathan Frederic
|
r17200 | 'magic_javascript' :{'reg':[/^%%javascript/]}, | ||
'magic_perl' :{'reg':[/^%%perl/]}, | ||||
'magic_ruby' :{'reg':[/^%%ruby/]}, | ||||
'magic_python' :{'reg':[/^%%python3?/]}, | ||||
'magic_shell' :{'reg':[/^%%bash/]}, | ||||
'magic_r' :{'reg':[/^%%R/]}, | ||||
'magic_text/x-cython' :{'reg':[/^%%cython/]}, | ||||
}, | ||||
Matthias BUSSONNIER
|
r8739 | |||
/** | ||||
* same as `cell_magic_highlight` but for raw cells | ||||
* @attribute raw_cell_highlight | ||||
*/ | ||||
Matthias BUSSONNIER
|
r8202 | raw_cell_highlight : { | ||
Jonathan Frederic
|
r17200 | 'diff' :{'reg':[/^diff/]} | ||
}, | ||||
}; | ||||
return { | ||||
'default_config': default_config, | ||||
}; | ||||
}); | ||||