A Table of contents generator for markdown.
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.
If you have Go just run:
go install github.com/madlambda/mdtoc/cmd/mdtoc@latest
If not, install Go :-).
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