README ¶
toc - 🚩 Zero configuration table of content generator for Markdown files.
toc
is a command-line tool and a Go library for generating table of contents form Markdown files.
Quick Start
go install go.mills.io/toc/cmd/toc@latest
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 by providing it as the first argument.
toc path/to/markdown.md
Create numbered list instead of bulleted list.
toc -l
Write result in-place to the file instead of standard output.
toc -w
Skip the first n
number of headers via -s
, --skip
flags.
toc -s 2
Set the number of maximum heading level to be included with -d
, --depth
flags.
Set maximum heading level to 3 (h3)
toc -d 3
Features
- Zero configuration
- Write in-place or to stdout
- Specify depth level
- Skip headings
- Use bulleted or numbered lists
Installation
Download the binaries from go.mills.io/prologic/toc:
go install go.mills.io/toc/cmd/toc@latest
Or build from source manually:
git clone https://git.mills.io/prologic/toc
cd toc
make install
Licence
toc
is licensed under the terms of the MIT License and was originally forked from @ycd's ycd/toc also licensed under an MIT License.
Documentation ¶
Overview ¶
Package toc creates table of contents from Markdown files
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ( // Version is the tagged release version in the form <major>.<minor>.<patch> // following semantic versioning and is overwritten by the build system. Version = defaultVersion // Commit is the commit sha of the build (normally from Git) and is overwritten // by the build system. Commit = defaultCommit // Build is the date and time of the build as an RFC3339 formatted string // and is overwritten by the build system. Build = defaultBuild )
Functions ¶
Types ¶
type Option ¶
Option is a function for defining new functional options