Skip to content

Instantly share code, notes, and snippets.

@sebble
Created May 7, 2014 10:49
Show Gist options
  • Save sebble/0bcf5a70bcc7721dd0af to your computer and use it in GitHub Desktop.
Save sebble/0bcf5a70bcc7721dd0af to your computer and use it in GitHub Desktop.
IPython Notebook Custom Style
/*
Placeholder for custom user CSS
mainly to be overridden in profile/static/custom/custom.css
This will always be an empty file in IPython
*/
/* set toolbar to hide by default */
.notebook_app #maintoolbar {
display: none;
}
/* cannot hide header by default.. */
.notebook_app #header {
display: none;
}
/* hide header image, move title into menubar */
.notebook_app #header {
height: 0;
}
.notebook_app #header #ipython_notebook {
display: none;
}
.notebook_app #header #save_widget {
margin: 3px 0 0 430px;
}
.notebook_app #header #checkpoint_status,
.notebook_app #header #autosave_status {
display: none;
}
/* add instant console */
.notebook_app #notebook-container > div:nth-last-child(2) {
position: fixed;
bottom: 8px;
background-color: #fff;
z-index: 99;
width: 940px;
padding: 5px;
}
@media (min-width: 1200px) {
.notebook_app #notebook-container > div:nth-last-child(2) {
width: 1170px;
}
}
@media (max-width: 979px) and (min-width: 768px) {
.notebook_app #notebook-container > div:nth-last-child(2) {
width: 724px;
}
}
@media (max-width: 767px) {
.notebook_app #notebook-container > div:nth-last-child(2) {
width: 100%;
}
}
.notebook_app #notebook-container > div:nth-last-child(2) .input_prompt {
visibility: hidden;
display: none;
}
.notebook_app #pager {
padding-bottom: 30px;
}
// leave at least 2 line with only a star on it below, or doc generation fails
/**
*
*
* Placeholder for custom user javascript
* mainly to be overridden in profile/static/custom/custom.js
* This will always be an empty file in IPython
*
* User could add any javascript in the `profile/static/custom/custom.js` file
* (and should create it if it does not exist).
* It will be executed by the ipython notebook at load time.
*
* Same thing with `profile/static/custom/custom.css` to inject custom css into the notebook.
*
* Example :
*
* Create a custom button in toolbar that execute `%qtconsole` in kernel
* and hence open a qtconsole attached to the same kernel as the current notebook
*
* $([IPython.events]).on('app_initialized.NotebookApp', function(){
* IPython.toolbar.add_buttons_group([
* {
* 'label' : 'run qtconsole',
* 'icon' : 'icon-terminal', // select your icon from http://fortawesome.github.io/Font-Awesome/icons
* 'callback': function () {
* IPython.notebook.kernel.execute('%qtconsole')
* }
* }
* // add more button here if needed.
* ]);
* });
*
* Example :
*
* Use `jQuery.getScript(url [, success(script, textStatus, jqXHR)] );`
* to load custom script into the notebook.
*
* // to load the metadata ui extension example.
* $.getScript('/static/notebook/js/celltoolbarpresets/example.js');
* // or
* // to load the metadata ui extension to control slideshow mode / reveal js for nbconvert
* $.getScript('/static/notebook/js/celltoolbarpresets/slideshow.js');
*
*
* @module IPython
* @namespace IPython
* @class customjs
* @static
*/
/* add instant console */
//$('body').append('<div id="instant_cell"></div>');
//IPython.notebook.kernel.insert_cell_at_bottom('code);
/** https://gist.github.com/minrk/5940801 **/
// add this to <profile>/static/custom/custom.js to load vim keybindings:
//$.getScript("/static/components/codemirror/keymap/vim.js", function() {
// if (! IPython.Cell) return;
// IPython.Cell.options_default.cm_config.keyMap = "vim";
//});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment