Skip to content
Juergen Hasch edited this page Nov 19, 2013 · 79 revisions

The IPython notebook allows extending the html frontend functionality (i.e. what you do in the Browser) using extensions written in Javascript. This repository contains a collection of such extensions. The maturity of the provided extensions may vary, please create an issue if you encounter any problems.

The repository is organized in several directories:

Directory Description
publishing publish notebooks on the web or convert to other formats
slidemode make slide creation for reveal.js easier
styling add custom styles to the notebook
testing alpha-level extension, not for general usage
usability improve usability of the notebook
usability/codefolding Fold code blocks using Alt-F or clicking on gutter
usability/read-only.js Allow codecells to be set read-only, so no editing is possible
usability/comment-uncomment.js Toggle comments in selected lines using Alt-C
usability/shift-tab.js Assign "shift-tab" key to dedent tabilator

General installation instruction

Extensions can be installed by copying the corresponding javascript extension and it's accompanying files to the static/custom directory of your IPython profile and adding it to custom.js.

Finding your profile directory

You can find out your profile directory by starting the IPython notebook and executing

import IPython
ip=IPython.get_ipython()
ip.config.ProfileDir 

This will give you something like {'location': u'C:\\Users\\me\\.ipython\\profile_dev'} or for Unix {'location': u'/home/you/.ipython/profile_default'}

So your path to copy the extensions into will be /home/you/.ipython/profile_default/static/custom

Adding the extension

Next, you copy the extension file or complete directory to the custom directory.

Finally, you have to add the extensions to the file custom.js in order to load them. This can be done best using the require command:

require(['/static/custom/styling/css-selector/main.js']) 

Your custom.js file might now look like this:

$([IPython.events]).on('app_initialized.NotebookApp', function(){
    require(['custom/clean_start']);
    require(['/static/custom/styling/css-selector/main.js']);
})

Clone this wiki locally