Question

I'm trying to install the great table of contents extension in a new computer. but I cant find it anymore. the only page I do find does not explain how to install the extension on windows.

So.. How can I install it, and why is it not a part of the official Ipython notebook? I simply can't understand how people are getting along without it.

No correct solution

OTHER TIPS

I've installed toc nbextension successfully with Jupyter 4 (ie. ipython notebook 4) recently. In fact installing extension is easier than before :)

I post my solution here, may it help.

## download 
mkdir toc
cd toc
wget https://raw.githubusercontent.com/minrk/ipython_extensions/master/nbextensions/toc.js
wget https://raw.githubusercontent.com/minrk/ipython_extensions/master/nbextensions/toc.css

## install and enable
cd ..
jupyter-nbextension install --user toc
jupyter-nbextension enable toc/toc

A bit more explain:

install will copy toc to ~/.local/share/jupyter/nbextensions/

enable will modify ~/.jupyter/nbconfig/notebook.json.

You can check these two place to see what happened.

Note: we use enable toc/toc here is because toc.js is in ~/.local/share/jupyter/nbextensions/toc/. If you put toc.js and toc.css directly in ~/.local/share/jupyter/nbextensions/ then you should use enable toc here.

Edit

Sorry, I didn't notice the orginal problem is on windows. I'm not sure if it's same for windows jupyter, any report is welcome.

Update

Now the toc nbextension has been added into this project which provide a collection of kinds of nbextensions. It's very easy to install and manage, worth to try!

I cannot tell you specific Windows advice, but think the key points should be platform independent:

  1. Create a profile (either a default profile or a named one - you'll probably want default to start).
  2. Locate where the profile is.
  3. Add the custom.js file into the profile.
  4. Edit the custom.js file to point to the notebook extension code.

In a bit more detail, setting up a profile is covered in detail here but for a default profile just go to the command line and enter

ipython profile

Next, locate where your profile is stored by typing at the command line

ipython locate

Call that <profile_dir>.

The rest follows the (Windows equivalent of!) the instructions on the link you have: underneath <profile_dir> navigate to (creating any directories that do not already exist)

<profile_dir>/static/custom/

and add the custom.js file as shown. Then edit the first line, where it has "nbextensions/toc" to point to the location where you have placed the toc.js file you have downloaded. This location is relative to the <profile_dir>; for me I have

<profile_dir>/static/custom/custom.js
<profile_dir>/static/custom/nbextensions/toc.js
<profile_dir>/static/custom/nbextensions/toc.css

and the first line of custom.js reads

require(["/static/custom/nbextensions/toc.js"], function (toc) {

Finally, note that this is with version 1.1.0 of the notebook - if you're using an earlier version I strongly suggest you upgrade before trying this.

You'll also find the official installation instructions at:

https://github.com/minrk/ipython_extensions

These instructions include curl commands for retrieving the toc.js and toc.css files from GitHub, which worked fine for me in a bash shell on linux Mint.

For Windows 7, I used a Git Shell (see http://msysgit.github.io/) to execute the curl commands

This IPython Notebook semi-automatically generates the files for minrk's table of contents in Windows. It does not use the 'curl'-commands or links, but writes the *.js and *.css files directly into your IPython Notebook-profile-directory.

There is a section in the notebook called 'What you need to do' - follow it and have a nice floating table of contents : )

Here is an html version which already shows it: http://htmlpreview.github.io/?https://github.com/ahambi/140824-TOC/blob/master/A%20floating%20table%20of%20contents.htm

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top