Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

tocbase-plugin-auto-id

Package Overview
Dependencies
Maintainers
1
Versions
14
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

tocbase-plugin-auto-id

A tocbase plugin for automatically generating ids of headings.

  • 3.0.11
  • unpublished
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
0
Maintainers
1
Weekly downloads
 
Created
Source

tocbase-plugin-auto-id

Minimized and gzipped size

A tocbase plugin for automatically generating ids of headings.

Requirements

tocbase version 8.4.5 or up.

Installing

From CDN

In your HTML page's <head>, include the following alongside tocbase library:

<script  src="https://unpkg.com/tocbase-plugin-auto-id@3.0.11/dist/cdn.umd.min.js"></script>

Note: It is recommend to use a fixed version(like above) instead of latest keyword, to avoid any troubles if breaking changes happen.

This will result in a autoId variable holding the plugin.

Using node and bundler

To install it run in your terminal:

npm i tocbase-plugin-auto-id

Import it in your script like below if you are using ESM syntax:

import autoId from "tocbase-plugin-auto-id";

You can also use common js syntax:

const autoId = require("tocbase-plugin-auto-id");

Follow your bundler's instructions for generating the output file and then load it in your HTML page through script tag to use it.

Usage

If used, it must be used as the first plugin:

const toc = createToc({ 
  plugins: [ autoId(), ],
});

Below is an example that configures the plugin with options:

const toc = createToc({
  plugins: [
    autoId({
      lowerCase: 0,
      separator: "_",
    }),
  ],
});

Options

separator

Type: String
Default: "-"

This is the separator to join words of a heading.

lowerCase

Type: Any value
Default: 1

If it's a truthy value the resulted id is lowercased otherwise the case remains intact.

Keywords

FAQs

Package last updated on 20 Sep 2022

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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc