mdtoc
A Markdown filter for generating numbered sections and a table of contents.
Last updated 9 years ago by kitcambridge .
Repository · Bugs · Original npm · Tarball · package.json
$ cnpm install mdtoc 
SYNC missed versions from official npm registry.

mdtoc.js

$ npm install -g mdtoc

mdtoc.js is a little Markdown filter that scans your document for headings, numbers them, adds anchors, and inserts a table of contents. It is a JavaScript port of Sam Stephenson's mdtoc.rb.

To use mdtoc, make sure that the headings you want numbered and linked are in this format:

### Title ###

Note that the headings must have an equal number of octothorpes around the title text (in Markdown, # means h1, ## means h2, and so on). The table of contents will be inserted before the first such heading.

lib/mdtoc.js exposes the mdtoc function, which accepts a string of Markdown source text as its only argument. It is compatible with web browsers, JavaScript engines, and CommonJS environments. The bin/mdtoc executable is Node-specific, and can be invoked like so:

$ mdtoc source.md
$ mdtoc first.md second.md | markdown
$ cat source.md | mdtoc
$ cat first.md | mdtoc second.md third.md | markdown

Current Tags

  • 1.0.0                                ...           latest (9 years ago)

1 Versions

  • 1.0.0                                ...           9 years ago
Maintainers (1)
Downloads
Today 0
This Week 0
This Month 0
Last Day 0
Last Week 0
Last Month 0
Dependencies (0)
None
Dev Dependencies (0)
None
Dependents (0)
None

Copyright 2014 - 2016 © taobao.org |