This is a standalone navigation enhancement for the IPython (>1.0) HTML Notebook.
- Thumbnails of input/output cells, scaled to their relative size in the notebook
- Click-to-scroll
- Instant search of cells with highlight
- Visual indication of cell execution
- Firefox (latest): good!
- Chrome (latest): okay...
- Offscreen elements aren't snapshotted correctly
- Safari 5: okay...
- Same as Chrome
- IE: haven't checked
I had been kicking this idea around for a while, and had done some execution previously, but the state of JavaScript enhancement to the Notebook was still an issue under discussion.
At this point, it seems like a commitment has been made to require.js
, which
at least handles multi-file dependencies within a plugin, but still doesn't prevent every other UI enhancement from, for example, bringing in d3.
You basically need to:
- drop the files from this repository in your
<profile>static/custom
folder - in that folder, create a
custom.js
- to that file, add a call to
require
to the IPython Notebook Navigator.js
file
Since we can safely assume you are using the IPython Notebook, here's a quick way to install it via the Notebook:
import os
import IPython
from urllib import urlretrieve
from zipfile import ZipFile
version = "0.0.0"
app_name = "ipython-notebook-navigator"
nav_url = "https://codeload.github.com/bollwyvl/%s/zip/v%s" % (app_name, version)
unzip_name = "%s-%s" % (app_name, version)
profile = IPython.utils.path.locate_profile()
custom = os.path.join(profile, "static", "custom")
ipynbnav = os.path.join(custom, "ipython-notebook-navigator")
if not os.path.exists(custom):
os.makedirs(custom)
with open(os.path.join(custom, "custom.js"), "a+") as custom_js:
custom_js.write('''
require(["custom/ipython-notebook-navigator/ipynbnav"], function(ipynbnav){
ipynbnav.init();
});
''')
zip_path, success = urlretrieve(nav_url, os.path.join(custom, "nav.zip"))
with ZipFile(zip_path, "r") as nav_zip:
nav_zip.extractall(custom)
os.rename(os.path.join(custom, unzip_name), ipynbnav)
os.unlink(zip_path)
This script is licensed under the BSD 3-Clause License.
For ease of installation, until IPython has a reasonable JavaScript package manager, the following libraries are distributed along with this code.
- d3 is licensed under the BSD License
- html2canvas is licensed under the MIT License