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

@domternal/extension-toc

v0.12.1

Published

Notion-style Table of Contents for Domternal: floating right-rail outline with collapsed/expanded states + insertable inline /toc block, both fed by a shared heading-discovery data layer

Readme

@domternal/extension-toc

Version MIT License

Notion-style Table of Contents for the Domternal editor.

A shared heading-discovery data layer feeds three pieces that work together:

  • TableOfContents - the headless heading observer that maintains a reactive heading list in editor.storage.toc and exposes the scrollToHeading command.
  • FloatingTocOutline - a sticky right-rail outline with a hover-expanded card, anchored to the editor or the viewport.
  • TableOfContentsBlock - an inline /toc atom node.

Active-heading tracking, smooth click-to-jump scrolling, and initial-load #hash navigation are built in.

Links

Website    •    Documentation    •    Live examples

Install

pnpm add @domternal/extension-toc

@domternal/core and @domternal/pm are peer dependencies. TableOfContents also requires the UniqueID extension (from @domternal/core) to be loaded: it reads UniqueID's id attribute on headings as the navigation anchor and stays inert without it.

Usage

import { Editor, StarterKit, UniqueID } from '@domternal/core';
import {
  TableOfContents,
  FloatingTocOutline,
  TableOfContentsBlock,
} from '@domternal/extension-toc';
import '@domternal/theme';

const editor = new Editor({
  element: document.getElementById('editor')!,
  extensions: [
    StarterKit,
    // UniqueID's default `types` already stamps headings; pass `types` only
    // when TableOfContents' `anchorTypes` point at custom node types.
    UniqueID,
    TableOfContents.configure({ levels: [1, 2, 3] }),
    FloatingTocOutline.configure({ anchor: 'editor' }),
    TableOfContentsBlock,
  ],
});

// Jump to a heading by its UniqueID-assigned id (updates the URL hash).
editor.commands.scrollToHeading('introduction');

// Read the live heading list, or subscribe via the onUpdate option.
console.log(editor.storage.toc.content); // HeadingEntry[]

UniqueID stamps ids on headings; TableOfContents watches the document and keeps editor.storage.toc in sync; FloatingTocOutline renders the sticky outline; TableOfContentsBlock adds the /toc atom so users can insert an inline contents list.

Exports

import {
  TableOfContents,
  tocPluginKey,
  FloatingTocOutline,
  floatingTocOutlinePluginKey,
  TableOfContentsBlock,
  walkHeadings,
  scrollToHeading,
  createActiveStateTracker,
} from '@domternal/extension-toc';

walkHeadings, scrollToHeading, and createActiveStateTracker are exposed as standalone helpers so you can build a custom outline UI on top of the same data layer and active-tracking rule.