Add Table of Contents to your Jupyter Notebook

This post was kindly contributed by SAS Programming for Data Mining - go there to comment and to read the full post.

Jupyter notebook does not support Table Of Contents (ToC) out of box, unlike R Markdown. There are nbextensions that ppl made to support this. It is easy to add this capability, following these steps to add Table of Contents to your notebook:

 1. Find your Jupyter Notebook data directory by using this command in your DOS console:
          a. Jupyter –data-dir

2. Copy the following two files into your Jupyter data directory:
           https://rawgithub.com/minrk/ipython_extensions/master/nbextensions/toc.js
           https://rawgithub.com/minrk/ipython_extensions/master/nbextensions/toc.css

3. Run this command:
           a. Jupyter nbextension enable toc –user

4. In your Jupyter Notebook, add this command to a MarkDown cell on top of your notebook:
           a. &lt div id=”toc” &gt &lt /div &gt

One caveat is that all headings will be listed in ToC, including your Title (if there is one). One easy work around is to write your title in Word, save a screenshot into an image, save the image file to the same folder as your notebook is, then use the following command in the top Markdown cell:

 &lt div style=”float: left;” &gt &lt img src=”Title.png” height=”200″ width=”800″&gt &lt /div &gt

This post was kindly contributed by SAS Programming for Data Mining - go there to comment and to read the full post.