Tocify
Tocify aims to create a table of contents for your markdown files. By default the generated ToC will be dumped to STDOUT. Add the -i
or --inject
flag to put the table of contents back into your file.
Table of Contents
- Installation
- Usage
- Sample Output
- Manual Insertion
- OS X
- Linux
- Contributing
Generated with tocify
Installation
Add this line to your application's Gemfile:
gem 'tocify'
And then execute:
$ bundle
Or install it yourself as:
$ gem install tocify
Usage
By default tocify will check for a file named README.md
in the current directory.
tocify
Otherwise you can pass in a filename as a parameter.
tocify OTHERFILE.md
To automatically insert the ToC into your README, run
tocify -i
Sample Output
When running tocify
on this file, you get:
## Table of Contents
* [Installation](#installation)
* [Usage](#usage)
* [Sample Output](#sample-output)
* [Manual Insertion](#manual-insertion)
* [OS X](#os-x)
* [Linux](#linux)
* [Contributing](#contributing)
Manual Insertion
If you want to manually insert the generated ToC you can. An easy way is to pipe the output of tocify
into your paste bufffer.
OS X
tocify | pbcopy
Linux
tocify | xclip
Requires xclip to be installed
Contributing
- Fork it
- Create your feature branch (
git checkout -b my-new-feature
) - Commit your changes (
git commit -am 'Add some feature'
) - Push to the branch (
git push origin my-new-feature
) - Create new Pull Request