1.0.4 • Published 4 years ago

docsify-page-toc v1.0.4

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

Docsify page ToC

npm NPM

It's a simple docsify plugin to print page's ToC. It's useful when your page gets longer and whole ToC overflows the the page height.

On the desktop browser, the ToC looks like: npm.io

How to install

Just add a built-in script to your HTML file:

<script src="//unpkg.com/docsify-page-toc/dist/docsify-page-toc.js"></script>

How to configure

There are 2 options you configure:

  • tocMaxLevel: The maximum depth of the headings printed on the ToC. If you set tocMaxLevel to 3, I recommand you to set subMaxLevel to 2 avoid ToC duplication.
  • target: The target heading printed on the ToC. It's used as an argument to query DOM with querySelectorAll()

Add these configuratios into your index.html:

window.$docsify = {
  ...
  'page-toc': {
    tocMaxLevel: 3,
    target: 'h1, h2, h3'
  },
}

Others

To support mobile browser, the ToC will automatically move to the top of the page when the display width is lower than 1300 pixels.

1.0.4

4 years ago

1.0.3

5 years ago

1.0.2

5 years ago

1.0.1

5 years ago

1.0.0

5 years ago