8
8
//============================================================================
9
9
// On document ready
10
10
//============================================================================
11
+ "use strict" ;
11
12
13
+ // for the time beeing, we have to pass marked as a parameter here,
14
+ // as injecting require.js make marked not to put itself in the globals,
15
+ // which make both this file fail at setting marked configuration, and textcell.js
16
+ // which search marked into global.
17
+ require ( [ 'components/marked/lib/marked' ] ,
12
18
13
- $ ( document ) . ready ( function ( ) {
19
+ function ( marked ) {
20
+
21
+ window . marked = marked
14
22
15
23
// monkey patch CM to be able to syntax highlight cell magics
16
24
// bug reported upstream,
17
25
// see https://github.com/marijnh/CodeMirror2/issues/670
18
26
if ( CodeMirror . getMode ( 1 , 'text/plain' ) . indent == undefined ) {
19
27
console . log ( 'patching CM for undefined indent' ) ;
20
- CodeMirror . modes . null = function ( ) { return { token : function ( stream ) { stream . skipToEnd ( ) ; } , indent : function ( ) { return 0 } } }
28
+ CodeMirror . modes . null = function ( ) {
29
+ return { token : function ( stream ) { stream . skipToEnd ( ) ; } , indent : function ( ) { return 0 } }
21
30
}
31
+ }
22
32
23
33
CodeMirror . patchedGetMode = function ( config , mode ) {
24
34
var cmmode = CodeMirror . getMode ( config , mode ) ;
@@ -90,10 +100,10 @@ $(document).ready(function () {
90
100
// only do this once
91
101
$ ( [ IPython . events ] ) . off ( 'notebook_loaded.Notebook' , first_load ) ;
92
102
} ;
93
-
103
+
94
104
$ ( [ IPython . events ] ) . on ( 'notebook_loaded.Notebook' , first_load ) ;
95
105
IPython . notebook . load_notebook ( $ ( 'body' ) . data ( 'notebookId' ) ) ;
96
-
106
+
97
107
if ( marked ) {
98
108
marked . setOptions ( {
99
109
gfm : true ,
@@ -110,6 +120,6 @@ $(document).ready(function () {
110
120
}
111
121
} )
112
122
}
123
+ }
113
124
114
- } ) ;
115
-
125
+ ) ;
0 commit comments