Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/takaishi/mdtoc

Generate and insert markdown's table of contents
https://github.com/takaishi/mdtoc

go markdown

Last synced: 7 days ago
JSON representation

Generate and insert markdown's table of contents

Awesome Lists containing this project

README

        

# mdtoc

[![Build Status](https://travis-ci.org/takaishi/mdtoc.svg?branch=master)](https://travis-ci.org/takaishi/mdtoc)

Generatr and insert table of content with markdown.

## Usage

```
$ mdtoc --help
NAME:
mdtoc - A new cli application

USAGE:
mdtoc [global options] command [command options] [arguments...]

VERSION:
0.0.1

COMMANDS:
help, h Shows a list of commands or help for one command

GLOBAL OPTIONS:
--file value, -f value Specify to generate TOC.
--in-file, -i Insert TOC to md file specified --file option.
--level value, -l value (default: 2)
--help, -h show help
--version, -v print the version
```

## Install

```
$ brew install takaishi/fomulas/mdtoc
```

## Example

```md
$ cat example.md
# This is example

## foo

aaa

## bar

bbb
```

Output markdown with TOC to stcout:

```
$ mdtoc -f ./example.md
# This is example

* [foo](#foo)
* [bar](#bar)

## foo

aaa

## bar

bbb
```

Overwrite file with TOC :

```
$ mdtoc -f ./example.md -i
$
$ cat example.md
# This is example

* [foo](#foo)
* [bar](#bar)

## foo

aaa

## bar

bbb
```

## Copyright

* Copyright(c) 2019- r_takaishi