Usage: toc [options]
Options:
-p, --path <path> Path for the markdown file. [REQUIRED]
-a, --append <bool> Append toc after <!--toc-->, or write to stdout. [Default: true]
-b, --bulleted <bool> Write as bulleted, or write as numbered list. [Default: true]
-s, --skip <int> Skip the first given number of headers. [Default: 0]
-d, --depth <int> Set the number of maximum heading level to be included. [Default: 6]
-h, --help Show this message and exit.
Add <!--toc--> to your markdown to the place where you want to add Table of Contents. That's it.
Give the markdown file as an input with -p, --path flags.
$ toc -p path/to/markdown.md
Create numbered list instead of bulleted list.
$ toc --bulleted=false
Write result to standard output instead of appending.
$ toc --append=false
Skip the first n number of headers via -s, --skip flags.
$ toc --skip 2
Set the number of maximum heading level to be included with -d, --depth flags.
Set maximum heading level to 3 (h3)
$ toc --depth 3
- For Arch Linux, install the `` package.
- For Homebrew on macOS, install the `` formula.
It is available via two tags.
You can either use latest or $VERSION.
docker run --rm -it yagizcan/toc:latest tocBinary downloads of example are available from the releases section on GitHub for 64-bit Windows, macOS, and Linux targets. They contain the compiled executable.
| platform |
|---|
| macOS 64 Bit |
| Linux 32-Bit |
| Linux ARM 64 Bit |
| Linux 64 Bit |
| Windows 64 Bit |
| Windows 32 Bit |
-
Verify that you have Go 1.13+ installed
$ go versionIf
gois not installed, follow instructions on the Go website. -
Clone this repository
$ git clone https://github.com/ycd/toc $ cd ycd -
Build and install
# May require you to use sudo $ go build . $ cp toc /usr/local/toc -
Verify installation
$ toc -h Usage: toc [options] Options: -p, --path <path> Path for the markdown file. [REQUIRED] -a, --append <bool> Append toc after <!--toc-->, or write to stdout. [Default: true] -b, --bulleted <bool> Write as bulleted, or write as numbered list. [Default: true] -s, --skip <int> Skip the first given number of headers. [Default: 0] -d, --depth <int> Set the number of maximum heading level to be included. [Default: 6] -h, --help Show this message and exit.
All kinds of Pull Requests and Feature Requests are welcomed!
toc's source code is licenced under the Apache 2.0 License.
