Giter Site home page Giter Site logo

magicianred / toc Goto Github PK

View Code? Open in Web Editor NEW

This project forked from ycd/toc

2.0 0.0 0.0 844 KB

๐Ÿšฉ TOC, zero configuration table of content generator for Markdown files, create table of contents from any Markdown file with ease.

License: Apache License 2.0

Go 99.31% Dockerfile 0.69%

toc's Introduction

toc

toc TOC, table of content generator for Markdown files

toc gif

Table of Contents


Usage

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

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.

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

    $ go version
    

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

  2. Clone this repository

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

    Unix/Linux

    # May require you to use sudo
    $ go build .
    $ cp toc /usr/local/toc
    
  4. 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.
    

Contributing

All kinds of Pull Requests and Feature Requests are welcomed!

Licence

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

toc's People

Contributors

0xflotus avatar joemiller avatar ycd avatar

Stargazers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.