@zkochan/remark-toc v0.2.0
remark-toc

Generate a Table of Contents in remark.
Installation
npm:
npm install remark-tocremark-toc is also available as an AMD, CommonJS, and globals module, uncompressed and compressed.
Usage
Dependencies:
var remark = require('remark');
var toc = require('remark-toc');Process:
var doc = remark().use(toc).process([
'# Alpha',
'',
'## Table of Contents',
'',
'## Bravo',
'',
'### Charlie',
'',
'## Delta',
''
].join('\n'));Yields:
# Alpha
## Table of Contents
- [Bravo](#bravo)
- [Charlie](#charlie)
- [Delta](#delta)
## Bravo
### Charlie
## DeltaAPI
remark.use(toc[, options])
Add a Table of Contents to a Markdown document.
Looks for the first heading containing
"Table of Contents","toc", ortable-of-contents(case insensitive, supports alt/title attributes for links and images too);Removes all following contents until an equal or higher heading is found;
Inserts a list representation of the hierarchy of following headings;
Adds links to following headings, using the same slugs as GitHub.
Options (Object, optional):
slug— Passed toremark-slug;heading(string?, default:"toc|table[ -]of[ -]contents?") — Heading to look for, wrapped innew RegExp('^(' + value + ')$', 'i');;maxDepth(number?, default:6) — Maximum heading depth to include in the table of contents, This is inclusive, thus, when set to3, level three headings, are included (those with three hashes,###);tight(boolean?, default:false) — Whether to compile list-items tightly.