🚀 Big News: Socket Acquires Coana to Bring Reachability Analysis to Every Appsec Team.Learn more
Socket
Book a DemoInstallSign in
Socket

bit-docs-html-toc

Package Overview
Dependencies
Maintainers
4
Versions
15
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

bit-docs-html-toc

table of contents bit-docs plugin

1.0.2
Source
npm
Version published
Weekly downloads
21
-51.16%
Maintainers
4
Weekly downloads
 
Created
Source

bit-docs-html-toc

npm version Build Status

A table of contents for use with bit-docs-generate-html.

screen shot 2016-11-10 at 10 16 55

screen shot 2016-11-10 at 10 15 51

screen shot 2016-11-09 at 17 02 17

Use

To use, add bit-docs-html-toc to your bit-docs dependencies in package.json:

{
  ...

  "bit-docs": {
    "dependencies": {
      "bit-docs-html-toc": "$VERSION"
    }
  }
}

Where $VERSION is the latest version on npm.

In your template add a <bit-toc> element:

<bit-toc></bit-toc>

Attributes

<bit-toc> supports the following attributes:

heading-container-selector

By default, all heading tags children of the first article tag on the page will be collected to create the table of contents; if you want to use a different element just do:

<bit-toc
  heading-container-selector="#my-custom-selector"
>
</bit-toc>

The table of contents will be injected into this element at run time.

depth

By default, only h2 elements are collected. You can change to include <h3> elements by setting depth like:

<bit-toc depth="2"></bit-toc>

Alternatively, the number of child headers that will be included in the TOC, use the @outline tag like so:

@outline 2

child-tag

If you want <li>'s to be within an <ol> instead of a <ul>, this can be configured like:

<bit-toc child-tag="ol"></bit-toc>

Methods

Call .highlight() to force an update of the active or completed class names on the <li> elements:

document.querySelector("bit-toc").highlight()

This happens automatically when the heading-container-selector element is scrolled.

Keywords

bit-docs

FAQs

Package last updated on 01 Apr 2019

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts