docsify-plugin-toc icon indicating copy to clipboard operation
docsify-plugin-toc copied to clipboard

page's ToC (Table of Content) for docsify.

docsify-plugin-toc

page's ToC for docsify.

npm

homepage

Usage

  1. Configure docsify-plugin-toc:

    <script>
    window.$docsify = {
      toc: {
        tocMaxLevel: 5,
        target: 'h2, h3, h4, h5, h6'
      },
    }
    </script>
    
  2. Insert style/script into docsify document:

    <!-- head -->
    <link rel="stylesheet" href="https://unpkg.com/[email protected]/dist/light.css">
    <!-- Also insert you custom css -->
    
    <!-- body -->
    <script src="https://unpkg.com/[email protected]/dist/docsify-plugin-toc.min.js"></script>
    

Options

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