0.0.11 • Published 6 years ago

markdown-it-toc-x3 v0.0.11

Weekly downloads
4
License
MIT
Repository
github
Last release
6 years ago

JavaScript Style Guide Build Status

Why another markdown-it table of contents plugin?

Most of the table of contents plugins for markdown-it out there wrap toc in <p></p>, i.e. they are inlined. When you have ul tag inside p, browsers would render it as:

<p></p>
<ol></ol>
<p></p>

It's ugly.

In markdown-it-toc-x3, it will be wrapped in a nav:

<nav class="toc">
<h2 class="toc__heading">Table of contents</h2>
<ol></ol>
</nav>

Usage

var md = require('markdown-it')({
  html: true,
  linkify: true,
  typography: true
}).use(require('markdown-it-toc-x3'))
md.render('{:toc}\n# heading one')

Remember to add placeholder {:toc} to where you want table of contents be inserted in your markdown file.

Options

You can specify options too:

NameDescriptionDefault
classcss class for table of contents' containertoc
hMinminimum heading level toc will show1
hMaxmaximun heading level toc will show6
enableHeadingIconadd an icon to heading anchorfalse
headingAnchorClassclass for heading anchoranchor
headingAnchorPrefixprefix for heading anchor
titleHeadingTable of contents
0.0.11

6 years ago

0.0.10

6 years ago

0.0.9

6 years ago

0.0.8

6 years ago

0.0.7

6 years ago

0.0.6

6 years ago

0.0.5

7 years ago

0.0.4

7 years ago

0.0.3

7 years ago

0.0.2

7 years ago

0.0.1

7 years ago