Markdown Table of Contents Generator
Quickly generate a table of contents from a markdown file and optionally insert it inline.
Table of Contents
Usage
Installation
npm i -D gen-md-toc
Example use
npx gen-md-toc
npx gen-md-toc -i
npx gen-md-toc -f CONTRIBUTING.md
Full usage info
Usage: gen-md-toc [options]
A tool for generating a table of contents for readmes
Options:
-V, --version output the version number
-f --file [README.md] specify where the readme file you want to use is (default: "README.md")
-i --inline [false] whether to edit the table of contents inline, it replaces for '<!-- toc-head -->' and <!-- toc-tail --> (default: false)
-h, --help output usage information
Dependancies
This module only has 2 dependancies, casex & commander,
as of writing neither of which have any nested dependancies.
API
You can use this programmatically in node by importing the module,
see cli.js for detailed usage.
const { tableOfContents, headTag, tailTag } = require('gen-md-toc')
tableOfContents(filename, inline)