Skip to content

Latest commit

 

History

History
53 lines (35 loc) · 1.33 KB

README.md

File metadata and controls

53 lines (35 loc) · 1.33 KB

mdtoc

GoDoc Static Analysis Status Test Status Go Report Card

A Table of contents generator for markdown.

Why ?

Feeling like having good TOCs on my markdowns and wanted to hack something simple for it.

It is not a comprehensive markdown parser, it does not have a lot of cool features, it probably do not even covers all markdown syntax use cases.

Right now it only works for atx syntax headers.

Install

If you have Go just run:

go install github.com/madlambda/mdtoc/cmd/mdtoc@latest

If not, install Go :-).

Usage

Input is read from stdin, results on stdout, Just run:

cat somemarkdownfile.md | mdtoc > newfile.md

The result will be a markdown with the TOC on its beginning. The TOC is generated based on the parsed headers.

You can also pass a file:

mdtoc somemarkdownfile.md > newfile.md

Or make the change in place:

mdtoc -w somemarkdownfile.md