Important: This documentation covers Yarn 1 (Classic).
For Yarn 2+ docs and migration guide, see yarnpkg.com.

Package detail

toc-util

cyokodog2MIT1.0.4TypeScript support: included

Usage

toc

readme

toc-util

Usage

import { makeTocElement } from 'toc-utl';

const firstHeadingElement = document.querySelector('h2') as HTMLHeadingElement;
const tocElement = makeTocElement(firstHeadingElement, { firstLevel: 2, lastLevel: 4 });
document.querySelector('.left-side').prepend(tocElement);

demo