python - Run some JavaScript every time a Jupyter Notebook loads -


i running jupyter notebook server , run arbitrary javascript code configure notebook every time loaded.

example of code have run...

$('div#maintoolbar').hide(); $('div#header-container').hide();  require(["codemirror/keymap/sublime", "notebook/js/cell", "base/js/namespace"],     function(sublime_keymap, cell, ipython) {         cell.cell.options_default.cm_config.keymap = 'sublime';         var cells = ipython.notebook.get_cells();         for(var c=0; c< cells.length ; c++){             cells[c].code_mirror.setoption('keymap', 'sublime');         }     }  ); 

i feel should easy can't quite find documentation on it...

the documentation have found refers ipython objects in javascript. suggestions on when use keywords ipython vs jupyter? example both ipython.keyboardmanager , jupyter.keyboardmanager valid javascript objects in notebook.

as hugh bothwell mentioned can put js in custom.js file, instead i'd suggest put in separate file , call in in custom.js (there guidelines of how in custom.js itself). can notebook extensions if more interested.

the difference between ipython , jupyter in kernel i.e. version of ipython, if running environments of ipython 3.5 or higher on jupyter, if on lower versions ipython. bad thing not compatible 1 other.


Comments

Popular posts from this blog

sublimetext3 - what keyboard shortcut is to comment/uncomment for this script tag in sublime -

java - No use of nillable="0" in SOAP Webservice -

ubuntu - Laravel 5.2 quickstart guide gives Not Found Error -