markdown-it-toc-gb

1.1.1 • Public • Published

markdown-it-toc

markdown-it plugin for adding a table of contents to markdown documents

Usage

Enable plugin

var md = require('markdown-it')({
  html: true,
  linkify: true,
  typography: true
}).use(require('markdown-it-toc-gb')); // <-- this use(package_name) is required

Example

[toc]

Adding this tag with add anchors to each <h[n]> tag on your document, and will add a <ul> of hyperlinks pointing to these places on the page.

The end results looks like:

<p>
     <ul>
    <li><a href="...">Heading 1</a></li>
    ...
    ... 
     </ul> 
</p>
...
...
<h1><a href="..."></a>Heading 1</h1>

Testing

To run the tests use:

make test

Package Sidebar

Install

npm i markdown-it-toc-gb

Weekly Downloads

3

Version

1.1.1

License

MIT

Unpacked Size

9.67 kB

Total Files

8

Last publish

Collaborators

  • javalitterboy