Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
Avatar for KuCalc : devops.
Download
50654 views
1
//----------------------------------------------------------------------------
2
// Copyright (C) 2012 The IPython Development Team
3
//
4
// Distributed under the terms of the BSD License. The full license is in
5
// the file COPYING, distributed as part of this software.
6
//----------------------------------------------------------------------------
7
8
//============================================================================
9
// Notebook
10
//============================================================================
11
12
/**
13
* @module IPython
14
* @namespace IPython
15
**/
16
17
var IPython = (function (IPython) {
18
"use strict";
19
/**
20
* A place where some stuff can be confugured.
21
*
22
* @class config
23
* @static
24
*
25
**/
26
var default_config = {
27
/**
28
* Dictionary of object to autodetect highlight mode for code cell.
29
* Item of the dictionnary should take the form :
30
*
31
* key : {'reg':[list_of_regexp]}
32
*
33
* where `key` will be the code mirror mode name
34
* and `list_of_regexp` should be a list of regext that should match
35
* the first line of the cell to trigger this mode.
36
*
37
* if `key` is prefixed by the `magic_` prefix the codemirror `mode`
38
* will be applied only at the end of the first line
39
*
40
* @attribute cell_magic_highlight
41
* @example
42
* This would trigger javascript mode
43
* from the second line if first line start with `%%javascript` or `%%jsmagic`
44
*
45
* cell_magic_highlight['magic_javascript'] = {'reg':[/^%%javascript/,/^%%jsmagic/]}
46
* @example
47
* This would trigger javascript mode
48
* from the second line if first line start with `var`
49
*
50
* cell_magic_highlight['javascript'] = {'reg':[/^var/]}
51
*/
52
cell_magic_highlight : {
53
'magic_javascript' :{'reg':[/^%%javascript/]}
54
,'magic_perl' :{'reg':[/^%%perl/]}
55
,'magic_ruby' :{'reg':[/^%%ruby/]}
56
,'magic_python' :{'reg':[/^%%python3?/]}
57
,'magic_shell' :{'reg':[/^%%bash/]}
58
,'magic_r' :{'reg':[/^%%R/]}
59
,'magic_text/x-cython' :{'reg':[/^%%cython/]}
60
},
61
62
/**
63
* same as `cell_magic_highlight` but for raw cells
64
* @attribute raw_cell_highlight
65
*/
66
raw_cell_highlight : {
67
'diff' :{'reg':[/^diff/]}
68
},
69
70
};
71
72
// use the same method to merge user configuration
73
IPython.config = {};
74
$.extend(IPython.config, default_config);
75
76
return IPython;
77
78
}(IPython));
79
80
81