Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/pyro2927/tocify
Generate a markdown-formatted table of contents from an existing file
https://github.com/pyro2927/tocify
Last synced: about 17 hours ago
JSON representation
Generate a markdown-formatted table of contents from an existing file
- Host: GitHub
- URL: https://github.com/pyro2927/tocify
- Owner: pyro2927
- License: mit
- Created: 2013-10-16T20:48:15.000Z (about 11 years ago)
- Default Branch: master
- Last Pushed: 2013-10-22T03:23:14.000Z (about 11 years ago)
- Last Synced: 2024-11-06T03:51:52.210Z (14 days ago)
- Language: Ruby
- Size: 141 KB
- Stars: 5
- Watchers: 5
- Forks: 1
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE.txt
Awesome Lists containing this project
README
# 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](#installation)
* [Usage](#usage)
* [Sample Output](#sample-output)
* [Manual Insertion](#manual-insertion)
* [OS X](#os-x)
* [Linux](#linux)
* [Contributing](#contributing)_Generated with [tocify](https://github.com/pyro2927/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, runtocify -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_
## Contributing1. Fork it
2. Create your feature branch (`git checkout -b my-new-feature`)
3. Commit your changes (`git commit -am 'Add some feature'`)
4. Push to the branch (`git push origin my-new-feature`)
5. Create new Pull Request