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

satteri-slug

v0.3.1

Published

Sätteri plugin to add `id` attributes to headings — a port of rehype-slug.

Readme

satteri-slug

Sätteri HAST plugin that adds an id to every heading — a port of rehype-slug.

Sätteri does not generate heading ids on its own: <h2>Hello World</h2> comes out without an id, so in-page anchors, table-of-contents links and #deep-links do not work. This plugin fills that gap using the same github-slugger implementation rehype-slug uses, so ids match what GitHub and your old unified pipeline produced.

Install

npm install satteri-slug

Use

import { markdownToHtml } from "satteri";
import { satteriSlug } from "satteri-slug";

const { html } = markdownToHtml("## Hello World", {
  hastPlugins: [satteriSlug()],
});
// <h2 id="hello-world">Hello World</h2>

With Astro 7:

// astro.config.mjs
import { defineConfig } from "astro/config";
import { satteri } from "@astrojs/markdown-satteri";
import { satteriSlug } from "satteri-slug";

export default defineConfig({
  markdown: {
    processor: satteri({
      hastPlugins: [satteriSlug()],
    }),
  },
});

Do you need this in Astro?

For ids alone, no: Astro's Sätteri processor already slugs headings with github-slugger, and it also collects them for Astro.props.headings.

You still need this plugin if anything of yours reads heading ids during the HAST stage — notably satteri-autolink-headings — because Astro's heading-id plugin is appended after your own, so the ids do not exist yet when your plugins run. Setting the id first is harmless: Astro's plugin keeps an existing id rather than replacing it.

Outside Astro — raw satteri, vite-plugin-satteri, or your own pipeline — nothing assigns heading ids, so this plugin is the only thing that will.

API

satteriSlug(options?)

Returns a Sätteri HAST plugin factory. Pass the result to hastPlugins, not the function itself — the factory gives each document a fresh duplicate counter.

options.prefix

string, default "". Prepended to every generated id.

satteriSlug({ prefix: "user-content-" });
// <h2 id="user-content-hello-world">Hello World</h2>

Behaviour

| Input | Output id | | --- | --- | | ## Hello, World! (again) | hello-world-again | | ## A \code` and em title|a-code-and-em-title| |## Same×3 |same, same-1, same-2| |## Café über naïve|café-über-naïve| |## !!!| `` (empty, as inrehype-slug`) |

Headings that already have an id are left untouched — including ids from Sätteri's headingAttributes feature (## Title {#custom}).

Differences from rehype-slug

  • Ships as a factory (satteriSlug()), matching Sätteri's per-document state model, rather than a unified().use() plugin.
  • Only heading elements are visited (filter: ["h1"…"h6"]) instead of walking every element, which is where Sätteri's speed comes from. Behaviour is otherwise identical.

Licence

MIT © Ashish Vaghela