npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

table-of-content

v1.1.1

Published

Table of Contents Generator is a JavaScript package that creates a floating table of contents (TOC) button and panel for website.

Downloads

26

Readme

Table of Contents Generator

(Original Vietnamese below)

Table of Contents Generator is a JavaScript package that creates a floating table of contents (TOC) button and panel for website. It automatically detects headings (H2, H3, H4) and generates a clickable TOC, enhancing navigation for long content.

Installation Guide

To install, use npm:

npm install table-of-content

No additional dependencies are required beyond a modern browser.

Purpose

– Generate a floating table of contents based on page headings.

– Show, hide the TOC button based on content visibility.

– Provide an interactive TOC panel that closes when clicking outside.

Workflow

  1. Include the package: Add the script to your HTML or import it in your JavaScript project.

  2. Automatic activation: The TOC button appears when scrolling over content with the .prose class and generates a TOC from headings.

  3. Manual control (optional): Use initTableOfContents() to start manually or destroy() to remove the TOC.

Example usage in HTML:

<script src="node_modules/table-of-content/index.js"></script>

Example usage in JavaScript:

const { initTableOfContents } = require('table-of-content');
initTableOfContents();
toc.destroy();

Contact & Support

– Email: [email protected].

– Website: nhavan.vn.

If you have any questions or suggestions, feel free to reach out for the fastest support.

Don’t forget to star this repository if you find it useful.

Trình tạo mục lục

Trình tạo mục lục là một gói JavaScript tạo ra một nút và bảng mục lục (TOC) nổi cho các website. Nó tự động phát hiện các tiêu đề (H2, H3, H4) và tạo ra một TOC có thể nhấp, cải thiện điều hướng cho nội dung dài.

Hướng dẫn cài đặt

Để cài đặt, sử dụng npm:

npm install table-of-content

Không yêu cầu thêm thư viện phụ thuộc ngoài trình duyệt hiện đại.

Công dụng

– Tạo mục lục nổi dựa trên các tiêu đề của trang.

– Hiển thị, ẩn nút TOC dựa trên khả năng hiển thị của nội dung.

– Cung cấp bảng TOC tương tác, đóng lại khi nhấp ra ngoài.

Flow thao tác

  1. Thêm gói: Thêm script vào HTML hoặc nhập vào dự án JavaScript của bạn.

  2. Kích hoạt tự động: Nút TOC xuất hiện khi cuộn qua nội dung có lớp .prose và tạo TOC từ các tiêu đề.

  3. Điều khiển thủ công (tùy chọn): Sử dụng initTableOfContents() để bắt đầu thủ công hoặc destroy() để xóa TOC.

Ví dụ sử dụng trong HTML:

<script src="node_modules/table-of-content/index.js"></script>

Ví dụ sử dụng trong JavaScript:

const { initTableOfContents } = require('table-of-content');
initTableOfContents();
toc.destroy();

Liên hệ & Hỗ trợ

– Email: [email protected].

– Website: nhavan.vn.

Nếu bạn có câu hỏi hoặc đề xuất, đừng ngần ngại liên hệ để được hỗ trợ nhanh nhất.

Đừng quên star repository này nếu bạn thấy nó hữu ích.