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

htmlat-rich

v0.1.3

Published

parse labels as css selectors and generate appropriate html

Readme

HTML-adapted text

Convert semtext-pairs into html, treating labels as css selectors that specify elements to generate.

(section.content-section){{
    (h1.section-title){{The section title}}
    (p.text-content){{Some text content here}}
    (div.photo-grid){{
        (img[src='an/image1.png']){{description}}
        (img[src='an/image2.png']){{description}}
    }}
}}

It uses emmet to parse the selectors, with some limitations.

What it doesn't do

  1. It will ignore any descendants, specified by the selector: div#address-container>span#address won't generate the span with it's attributes: it only will generate the div with it's attributes.
  2. It will ignore the text content: {text content} (probably, it won't parse it)
  3. It doesn't support @emmetio/abbreviaton's selector grouping with braces (see their readme): the semtext-pairs syntax doesn't support nested braces - this (a>(b>c+d)*4){{an/url}} will break the parsing.

img: the alt attribute

It will treat first-occurring text in the img entity as the alt attribute: (img){{image description}} will produce <img alt="image description">. It will ignore any other entities in the entity, e.g. (img){{(div){{illegal div}} image description}} will produce <img alt=" image description">.

XSS prevention

Generally, I suppose, the logic outlined in showdown article applies here. I.e., sanitize the generated html as opposed to the semtext-pairs formatted text.

Sanitizing encoded content doesn't work

By default, htmlat-rich escapes any html occurring in the text nodes. A consequence of that is that the escaped nodes become invisible to sanitizer and don't get erased.

You can prevent escaping by setting the spanTextNodes option to true. However, then the content of text nodes will be wrapped in spans, which might not be what we want in the end. spanToTextTextNodes converts the spans into Text nodes.

In conclusion, if you want to sanitize the output, what you should do is:

  1. convert with spanTextNodes enabled
  2. sanitize
  3. convert spans to Text nodes with spanToTextTextNodes

If any html tags left in the text after sanitization, they will be escaped.

CLI

Here is a cli with this package under the hood and some additional features.