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

jth-html

v0.4.0

Published

HTML DSL for jth: build HTML trees on the stack and render them to strings. Importing the package registers its operators with the global jth-runtime registry as a side effect.

Readme

jth-html

HTML DSL for jth: build HTML trees on the stack and render them to strings. Importing the package registers its operators with the global jth-runtime registry as a side effect.

Installation

npm install jth-html

Loading the ops (opt-in)

The compiler preamble only auto-loads jth-stdlib — the h-* ops are not available by default. A .jth program opts in with an import directive, which the compiler passes through so the package registers its ops at module load:

::import "jth-html";

#[ "Hello" h-text ] "h1" h-tag h-render peek;
jth run page.jth
# <h1>Hello</h1>

From JavaScript, import "jth-html" (or call registerHTML() explicitly).

Registered operators

| Operator | Stack effect | Description | |----------|--------------|-------------| | h-tag | block "tag"element | Executes the block on a child stack; its items become children | | h-text | valuetextNode | Text node (HTML-escaped on render) | | h-raw | valuerawNode | Raw HTML, rendered without escaping | | h-frag | blockfragment | Fragment: children render with no wrapper tag | | h-void | "tag"element | Element with no children (e.g. meta, br) | | h-attrs | element { k v … }element | Merges an attribute object onto an element | | h-render | node"html" | Renders a node tree to an HTML string |

Dynamic h-<tag> shorthand

Any name matching h-<lowercase-tag> that is not one of the static ops works as a shorthand: block h-divblock "div" h-tag (registered via a dynamic registry pattern in src/register.ts).

Rendering rules

  • Text nodes and attribute values are HTML-escaped (& < > " '); h-raw output is not.
  • Boolean attributes: true renders as a bare attribute, false is omitted.
  • Void elements (br, meta, img, …) render without a closing tag.

JavaScript API

import { registerHTML, render, createElement, createText, createRaw, createFragment } from "jth-html";

Also exported: the operator implementations (hTag, hText, hRaw, hFrag, hVoid, hAttrs, hRender), node type interfaces (ElementNode, TextNode, RawNode, FragmentNode, HtmlNode), and escapeHtml.

Example

See examples/html.jth in the repo root — it builds a full page and is covered by an end-to-end CLI test.