-
Notifications
You must be signed in to change notification settings - Fork 0
Home
The IPython notebook functionality (i.e. what you do with the Browser) can be extended using Javascript extensions. 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.
| IPython Version | Description |
|---|---|
| 1.x | not supported |
| 2.x | checkout 2.x branch |
| 3.x | checkout 3.x branch |
There are different branches of the notebook extensions in this repository. Please make sure you use the branch corresponding to your IPython version. Not all extensions may be available in 2.x and 3.x.
Note: This is not related to the Python version.
#Overview The repository is organized in different categories:
| Name | Description |
|---|---|
| usability | Additional functionality for the notebook |
| publishing | Getting your notebooks out in the wild |
| styling | Styling schemes for different looks of the notebook |
| slidemode | Slideshow creation |
| testing | Extensions in a early stage |
##Usability
| File or Directory | Description |
|---|---|
| aspell | Spellchecker using aspell |
| breakpoints | Allow setting of breakpoints to stop execution of notebook cells |
| chrome_clipboard | Add system clipboard actions with crome |
| codefolding | Fold code blocks using Alt-F or clicking on gutter |
| comment-uncomment.js | Toggle comments in selected lines using Alt-C |
| executeTime.js | Display when each cell has been executed and how long it took |
| drag-and-drop | Allow dragging of images into a notebook |
| help_panel.js | Display panel with hotkey help |
| hide_input_all | Hide all codecells in a notebook |
| linenumbers.js | Add line numbers to code cells |
| navigation-hotkeys.js | Change hotkeys for navigation in notebook |
| python-markdown.js | Display Python variables in markdown |
| read-only.js | Allow codecells to be set read-only, so no editing is possible |
| rubberband | Multi-cell selection tool |
| runtools | Add toolbar buttons for additional code execution options |
| search.js | Search notebook for expressions |
| shift-tab.js | Assign "shift-tab" key to dedent tabulator |
##Publishing
| File or Directory | Description |
|---|---|
| printview-button | Add a toolbar button to call nbconvert --to html for current the notebook and display html in new browser tab. Uses current user profile. |
| printviewmenu-button | Add a toolbar button to call menu entry File->Print Preview directly (V2 only) |
| gist_it | Publish notebook as a gist |
| nbviewer_theme | |
| htmltools/js_highlight.py | A python tool to customize the css classes of nbconvert's html code blocks to fit your favourite JS syntax highlighter |
##Styling
| File or Directory | Description |
|---|---|
| styling/css_selector | |
| styling/zenmode |
##Slidemode
| File or Directory | Description |
|---|---|
| slidemode | Make slide creation for reveal.js easier |
##Testing
| File or Directory | Description |
|---|---|
| hierarchical_collapse | Adds a button to hide all cells below the selected heading |
| history | |
| swc | |
| cellstate |
Notebook extensions can be installed by copying the corresponding javascript extension and it's accompanying files to the nbextensions directory of your local IPython directory (aka IPYTHONDIR) and calling it either directly in a notebook or adding it to the custom.js in your local profile.
The easiest way to install an extension is directly from IPython:
import IPython
IPython.html.nbextensions.install_nbextension('https://rawgithub.com/minrk/ipython_extensions/master/nbextensions/gist.js')You can verify if your extension has been installed by using
IPython.html.nbextensions.check_nbextension('gist.js')First you need to find your local IPython directory. This can be done from command line:
ipython locate
or in IPython by executing:
import IPython
ip=IPython.get_ipython()
ip.ipython_dirNow copy your notebook extension files in the nbextensions subdirectoy.
Once the notebook extension has been installed, they can be loaded like this:
%%javascript
IPython.load_extensions('gist');If you want an extension to be always loaded, you need to call it in your local custom.js file.
First locate your profile directory:
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 file will be located here:
/home/you/.ipython/profile_default/static/custom/custom.js
This is where you add a line to call your notebook extension. How to do this is described in the next section.
Your custom.js should look like this:
// activate extensions only after Notebook is initialized
require(["base/js/events"], function (events) {
$([IPython.events]).on("app_initialized.NotebookApp", function () {
/* load your extension here */
IPython.load_extensions('gist');
});
});Your custom.js should look like this:
// activate extensions only after Notebook is initialized
require(["base/js/events"], function (events) {
events.on("app_initialized.NotebookApp", function () {
/* load your extension here */
IPython.load_extensions('gist');
});
});In the example above, the toc.js is loaded. Note: You don't need to specify the .js file extension.
A template custom.js file is geven here : ipython-contrib/custom.example.js
It is also possible to add additional locations where extensions or the custom.js file can be placed.
This can be configured in the ipython_notebook_config.py file. To find out if
you have configured an extra path type:
ip.config.NotebookApp.extra_static_pathsIf the extension does not work, here is how you can check what is wrong:
- Clear your browser cache or start a private browser tab.
- Verify your
custom.jsis the one the IPython notebook is seeing, by opening it in the browser:http://127.0.0.1:8888/static/custom/custom.js
(as opposed to../site-packages/IPython/html/static/custom/custom.js,
which may the onlycustom.jsloaded if you are using a virtualenv) - Verify the extension can be loaded by the IPython notebook, for example:
http://127.0.0.1:8888/nbextensions/gist.js - Check for error messages in the JavaScript console.
Aspell
Breakpoints
Chrome Clipboard
Codefolding
Comment Uncomment
Drag and Drop
Execute Timings
Help Panel
Hide Input All
Hierarchical Collapse
International Keymap
Javascript Highlighter
LaTeX Environments
Limit Output
Linenumbers
Navigation Hotkeys
Nbconvert Button
Printview Button
Printviewmenu Button
Python Markdown
Readonly
Rubberband
Runtools
Search & Replace
Search
Shift-Tab 3.x
Skip Traceback