TOCBot
Introduction
TOCBot is a Table of Content (TOC) creation robot. It works by reading a markdown file and identifying all of the headers (currently up to 5 levels deep) and creating a table of contents based on those headers.
It will insert the table of contents between the separators that are placed in the file. The current separator is <!--TOC-->.
There must be TWO separators, one to open the table of contents and one to close it.
TOCBot will also add links above each header in order to make the Table of Contents clickable.
Installation
Installing TOCBot is very simple, just execute the following command.
gem install tocbot
Basic Usage
You can execute TOCBot by simple running
tocbot
Command Line Usage
| Option | Purpose | Default Value |
|---|---|---|
| -h or --help | Show the help message | N/A |
| -f or --filename | The name of the file to process. | README.md |
Contributing to TOCBot
Setup
After checking out the repo, run bin/setup to install dependencies. Then, run rake spec to run the tests. You can also run bin/console for an interactive prompt that will allow you to experiment.
To install this gem onto your local machine, run bundle exec rake install. To release a new version, update the version number in version.rb, and then run bundle exec rake release, which will
create a git tag for the version, push git commits and tags, and push the .gem file to rubygems.org.
Testing
For local testing make sure that you run bundle exec rspec spec and then rake install to install the gem locally.
For further information please refer to the contributing documentation.
To-Do List
- [ ] Allow users to specify the separator
- [ ] Allow users to specify how deep into the headers to go
- [ ] Allow users to specify levels to skip