@ -8,17 +8,27 @@
//============================================================================
// On document ready
//============================================================================
"use strict" ;
// for the time beeing, we have to pass marked as a parameter here,
// as injecting require.js make marked not to put itself in the globals,
// which make both this file fail at setting marked configuration, and textcell.js
// which search marked into global.
require ( [ 'components/marked/lib/marked' ] ,
$ ( document ) . ready ( function ( ) {
function ( marked ) {
window . marked = marked
// monkey patch CM to be able to syntax highlight cell magics
// bug reported upstream,
// see https://github.com/marijnh/CodeMirror2/issues/670
if ( CodeMirror . getMode ( 1 , 'text/plain' ) . indent == undefined ) {
console . log ( 'patching CM for undefined indent' ) ;
CodeMirror . modes . null = function ( ) { return { token : function ( stream ) { stream . skipToEnd ( ) ; } , indent : function ( ) { return 0 } } }
CodeMirror . modes . null = function ( ) {
return { token : function ( stream ) { stream . skipToEnd ( ) ; } , indent : function ( ) { return 0 } }
}
}
CodeMirror . patchedGetMode = function ( config , mode ) {
var cmmode = CodeMirror . getMode ( config , mode ) ;
@ -90,10 +100,10 @@ $(document).ready(function () {
// only do this once
$ ( [ IPython . events ] ) . off ( 'notebook_loaded.Notebook' , first _load ) ;
} ;
$ ( [ IPython . events ] ) . on ( 'notebook_loaded.Notebook' , first _load ) ;
IPython . notebook . load _notebook ( $ ( 'body' ) . data ( 'notebookId' ) ) ;
if ( marked ) {
marked . setOptions ( {
gfm : true ,
@ -110,6 +120,6 @@ $(document).ready(function () {
}
} )
}
}
} ) ;
) ;