项目作者: ycd

项目描述 :
🚩 TOC, zero configuration table of content generator for Markdown files, create table of contents from any Markdown file with ease.
高级语言: Go
项目地址: git://github.com/ycd/toc.git
创建时间: 2021-01-19T20:17:51Z
项目社区:https://github.com/ycd/toc

开源协议:Apache License 2.0

下载



toc



toc TOC, table of content generator for Markdown files


toc gif

Table of Contents


Usage

  1. Usage: toc [options]
  2. Options:
  3. -p, --path <path> Path for the markdown file. [REQUIRED]
  4. -a, --append <bool> Append toc after <!--toc-->, or write to stdout. [Default: true]
  5. -b, --bulleted <bool> Write as bulleted, or write as numbered list. [Default: true]
  6. -s, --skip <int> Skip the first given number of headers. [Default: 0]
  7. -d, --depth <int> Set the number of maximum heading level to be included. [Default: 6]
  8. -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.

  1. $ toc -p path/to/markdown.md

Create numbered list instead of bulleted list.

  1. $ toc --bulleted=false

Write result to standard output instead of appending.

  1. $ toc --append=false

Skip the first n number of headers via -s, --skip flags.

  1. $ toc --skip 2

Set the number of maximum heading level to be included with -d, --depth flags.

Set maximum heading level to 3 (h3)

  1. $ toc --depth 3

Installation

Packages

Arch Linux

  • For Arch Linux, install the `` package.

Homebrew

  • For Homebrew on macOS, install the `` formula.

Docker

It is available via two tags.

You can either use latest or $VERSION.

  1. docker run --rm -it yagizcan/toc:latest toc

Downloads

Binary 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

Installation from source

  1. Verify that you have Go 1.13+ installed

    1. $ go version

    If go is not installed, follow instructions on the Go website.

  2. Clone this repository

    1. $ git clone https://github.com/ycd/toc
    2. $ cd ycd
  3. Build and install

    Unix/Linux

    1. # May require you to use sudo
    2. $ go build .
    3. $ cp toc /usr/local/toc
  4. Verify installation

    1. $ toc -h
    2. Usage: toc [options]
    3. Options:
    4. -p, --path <path> Path for the markdown file. [REQUIRED]
    5. -a, --append <bool> Append toc after <!--toc-->, or write to stdout. [Default: true]
    6. -b, --bulleted <bool> Write as bulleted, or write as numbered list. [Default: true]
    7. -s, --skip <int> Skip the first given number of headers. [Default: 0]
    8. -d, --depth <int> Set the number of maximum heading level to be included. [Default: 6]
    9. -h, --help Show this message and exit.

Contributing

All kinds of Pull Requests and Feature Requests are welcomed!

Licence

toc’s source code is licenced under the Apache 2.0 License.