Release 1.0.2.
This script can be used to generate a Markdown Table of Contents from a Markdown source document. For more information, see my related blog post.
You only require a system Ruby. Tested on Ruby versions 1.9 through to 2.7.
Install by copying the script from the master branch:
To build the docker file run.
docker build .
To run the docker file against your README. CD into your directory and run (this assumes your readme file is README.md)
docker run -v `pwd`:/host <name of image>
▶ curl \
https://raw.githubusercontent.com/alexharv074/markdown_toc/master/mdtoc.rb -o \
/usr/local/bin/mdtoc.rb
Help message:
▶ mdtoc.rb -h
Usage: mdtoc.rb FILE.md [TOP [MAX]] [-h]
FILE.md Markdown source document
TOP top-level Markdown heading level (default 2)
MAX maximum heading level (default 4)
On Mac OS X, the pbcopy
command is useful, for example:
▶ mdtoc.rb README.md | pbcopy
▶ vim README.md # then paste in the ToC!
MIT.