Installing Table of Contents extension to Jupyter notebook

Table of contents 2 is a very useful extension to Jupyter notebook that allows you to have a nested outline with links to all the Markdown headings in a Jupyter notebook. This is basically essential when you’re working with a notebook of any real length. I don’t know why it isn’t just a standard feature in Jupyter.

Figuring out how to install it is a bit annoying as instructions are poorly written across several Github repos, but the process is actually very simple (if a little hacky). Assuming you followed my instructions on setting up a virtual environment in Python 3, activate it with (substitute your own path if needed):

source .virtualenvs/jupyter/

Now install jupyter_contrib_nbextensions. This bundles a bunch of extensions to Jupyter, as well as a configuration panel that will be added to the Jupyter interface.

pip install jupyter_contrib_nbextensions

This command is needed to complete the installation of the extensions to Jupyter itself:

jupyter contrib nbextension install --user

Now on the main Jupyter page, click the tab “Nbextensions”, then check the box for “Table of contents (2)”.

Screen Shot 2018-04-19 at 7.03.29 PM

Screen Shot 2018-04-19 at 7.03.37 PM

Now when you start a notebook, click the “Table of Contents” button, and you’ll get a sidebar on the left with your table of contents. Voila!

Screen Shot 2018-04-19 at 10.34.31 PM

Screen Shot 2018-04-19 at 10.36.41 PM

Advertisements
This entry was posted in Data analysis, Not biology. Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s