The GitHub flavored Markdown ToC generator.
JavaScript
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
bin
lib
README.md
index.js
package.json

README.md

gfmtoc

Generate ToC for Markdown text in GitHub Style

INSTALL

$ npm install -g @hail2u/gfmtoc

USAGE

Write foo.md:

Test
====

<!-- #toc -->
<!-- /toc -->

Foo
---

### Foo Foo

### Foo Bar

Bar
---

### Bar Foo

Then run:

$ gfmtoc foo.md

Get:

Test
====

<!-- #toc -->

* [Foo](#foo)
  * [Foo Foo](#foo-foo)
  * [Foo Bar](#foo-bar)
* [Bar](#bar)
  * [Bar Foo](#bar-foo)

<!-- /toc -->

Foo
---

### Foo Foo

### Foo Bar

Bar
---

### Bar Foo

NOTE

marked v0.3.5 has a bug when parsing a comment along with ---- syntax (it’s generate hr) on Node.js v7.4.0. You should avoid using ---- syntax just after comment, especially in gfmtoc’s special comment, by adding blank line(s):

<!-- #toc -->
<!-- /toc -->

----

Or, use **** for hr.

LICENSE

MIT: http://hail2u.mit-license.org/2014