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

@u1f992/rehype-selector-transforms

v0.1.0

Published

Declarative, selector-driven document transformations for rehype.

Readme

@u1f992/rehype-selector-transforms

This package provides reusable, high-level rehype plugins for applying declarative document transformations with CSS selectors. Transformations are applied in configuration order, so each one can operate on the results of earlier transformations.

They can keep Markdown manuscripts readable in ordinary previews while adding or removing typesetting-specific structures for CSS typesetting in Vivliostyle CLI.

empty

The empty plugin removes all child nodes from elements matching CSS selectors.

A cross-reference anchor can be left empty because CSS-generated content supplies its label:

[](#fig){.xref-img}

![caption](img.png){#fig}
figure {
  counter-increment: img;
}

figcaption::before {
  content: "Figure " counter(img);
}

.xref-img::before {
  content: "Figure " target-counter(attr(href), img);
}

An ordinary Markdown preview does not evaluate this CSS, so the empty anchor has no visible label. Text can be added to the anchor for the preview:

[Figure ??](#fig){.xref-img}

Figure ?? is an actual child of the anchor, not a fallback interpreted by CSS. If left in place, it appears alongside the generated label during typesetting. This plugin removes all children from matching elements before typesetting while preserving the elements and their attributes.

wrap and wrapInner

Some complex typesetting layouts require nested boxes that cannot be produced by a single element's margin, border, and padding. The wrap and wrapInner plugins add div or span wrappers around selected elements or their contents, keeping presentational markup out of Markdown source documents.

wrap

The wrap plugin places a generated element around each selected element.

Applying wrap repeatedly to the same element creates multiple layers from the outside in:

<div class="heading-outer">
  <div class="heading-inner">
    <h1>Heading</h1>
  </div>
</div>

wrapInner

The wrapInner plugin preserves the selected element and wraps all of its children in a generated element. For example, wrapInner can insert a span as a formatting box inside a heading or another element that accepts phrasing content. This keeps presentational markup out of Markdown source documents.

<h1>
  <span class="heading-content">Heading</span>
</h1>

More advanced replacements

The replace plugin supports transformations that cannot be expressed as a fixed inner or outer wrapper. It can replace each selected element with any number of generated nodes.