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 🙏

© 2025 – Pkg Stats / Ryan Hefner

@hendotcat/11tyhype

v2.0.0

Published

Rehype plugin for 11ty

Readme

11tyhype is a rehype plugin for Eleventy. It hooks up rehype as an HTML transform so you can add rehype plugins to your Eleventy site with less boilerplate.

Installation

yarn add -D @hendotcat/11tyhype rehype

Usage

This example uses rehype-minify-whitespace to strip out all the whitespace from the HTML of an Eleventy site.

const { rehypePlugin } = require("@hendotcat/11tyhype")
const minifyWhitespace = require("rehype-minify-whitespace")

module.exports = function(eleventyConfig) {
  eleventyConfig.addPlugin(rehypePlugin, {
    plugins: [
      [minifyWhitespace],
    ]
  })
}

Options

plugins

The plugins array is a list of rehype plugins to use. Each element of the array is an array of parameters that will be passed to rehype's use() function.

  1. The first array element should be the plugin function. In the example above that's minifyWhitespace.
  2. The second array element is optional. It's for passing options to plugins.

Here's an example with some options. It's using rehype-urls, and the second parameter tells the plugin to prefix every URL it finds with https://example.org/.

const { rehypePlugin } = require("@hendotcat/11tyhype")
const urls = require("rehype-urls")

module.exports = function(eleventyConfig) {
  eleventyConfig.addPlugin(rehypePlugin, {
    plugins: [
      [urls, url => {
        return `https://example.org/${url.href}`
      }],
    ]
  })
}

id

If you have a lot of transforms in your Eleventy build then naming them can be helpful for debugging build problems. So you can optionally pass an id string to 11tyhype and it'll use this value as the name for the transform.

verbose

Pass verbose: true to the plugin and it'll output a whole bunch of information about what it's doing. This is mostly useful for debugging. Please enable this this option if you're reporting a bug in 11tyhype.

Error Codes

11tyhype will try to help you set it up properly. If you make a mistake, it'll try to help you understand. For some mistakes that it can recognize, it'll print a link in the build output pointing at one of these error codes to help you troubleshoot.

no-plugins

This error code is generated when you add the plugin to Eleventy without giving it any rehype plugins to apply.

Double check your code against the example at the top of this readme. The second argument you pass to eleventyConfig.addPlugin should be an object with a property called plugins.

invalid-plugin

This error code is generated when you add the plugin to Eleventy with a mistake in the list of plugins. The error message will tell you which plugin in your list has the mistake: e.g. if it says plugin #1 is invalid then the very first plugin in your list is the one that's wrong.

Read the instructions for the plugins option and check that the plugin specified by the error message has a rehype plugin function as its first array element.

Contributing

Contributor Covenant v2.0

License

MIT