1. markdown-it-github-toc
markdown-it plugin to add toc and anchor links in headings
markdown-it-github-toc
Package: markdown-it-github-toc
Created by: tylingsoft
Last modified: Sun, 19 Jun 2022 16:08:07 GMT
Version: 3.2.4
License: MIT
Downloads: 4,069
Repository: https://github.com/tylingsoft/markdown-it-github-toc

Install

npm install markdown-it-github-toc
yarn add markdown-it-github-toc

markdown-it-github-toc

markdown-it plugin to add toc and GitHub style heading anchors

Installation

 $ npm install markdown-it-github-toc

Usage

 import markdownIt from "markdown-it"
import markdownItGithubToc from "markdown-it-github-toc"

markdownIt({
    html: true,
    linkify: true,
    typography: true,
  })
    .use(markdownItGithubToc, {
      // ...options
    })
    .render(md)

Options

toc

(default: true)

Allow you to enable/disable the toc transformation of [toc]

tocClassName

(default: "markdownIt-TOC")

Option to customize html class of the <ul> wrapping the toc

tocFirstLevel

(default: 1)

Allow you to skip some heading level. Example: use 2 if you want to skip <h1>
from the TOC.

tocLastLevel

(default: 6)

Allow you to skip some heading level. Example: use 5 if you want to skip <h6>
from the TOC.

anchorLink

(default: true)

Allow you to enable/disable the anchor link in the headings

anchorLinkSymbol

(default: "#")

Allow you to customize the anchor link symbol

anchorLinkSpace

(default: true)

Allow you to enable/disable inserting a space between the anchor link and heading.

anchorLinkSymbolClassName

(default: null)

Allow you to customize the anchor link symbol class name. If not null, symbol will be rendered as <span class="anchorLinkSymbolClassName">anchorLinkSymbol</span>.

anchorLinkBefore

(default: true)

Allow you to prepend/append the anchor link in the headings

anchorClassName

(default: "markdownIt-Anchor")

Allow you to customize the anchor link class

resetIds

(default: true)

Allow you to reset (or not) ids incrementation. Use it if you will have multiple
documents on the same page.

indentation

(default: " ")

Allow you to customize indentation

License

MIT

Dependencies

RELATED POST

10 Must-Know Windows Shortcuts That Will Save You Time

10 Must-Know Windows Shortcuts That Will Save You Time

Arrays vs Linked Lists: Which is Better for Memory Management in Data Structures?

Arrays vs Linked Lists: Which is Better for Memory Management in Data Structures?

Navigating AWS Networking: Essential Hacks for Smooth Operation

Navigating AWS Networking: Essential Hacks for Smooth Operation

Achieving Stunning Visuals with Unity's Global Illumination

Achieving Stunning Visuals with Unity's Global Illumination

Nim's Hidden Gems: Lesser-known Features for Writing Efficient Code

Nim's Hidden Gems: Lesser-known Features for Writing Efficient Code