Github Readme Table Of Contents Generation

I don’t like manually creating a table of contents on Github so this is how I figured out how to generate it.

1. Install npm

See the docs for installation insturctions

If on linux:

apt-get install npm

You may have to run the below command if you installed via a package manager:

ln -s /usr/bin/nodejs /usr/bin/node

2. Install doctoc

You may have to use sudo to install.

npm install -g doctoc

3. Run doctoc

doctoc --title '## Contents'

Re-run this command to re-generate the TOC. :)

Written on February 18, 2015