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

ultramark

v0.1.0

Published

Aggressively small, streaming markdown for agents (strict subset)

Readme

ultramark

An aggressively small, streaming markdown parser for agents — ~1.5 KB gzipped, zero dependencies.

Agent output is reliably well-shaped, so ultramark implements a strict, streaming-safe subset of Markdown rather than all of CommonMark. Every ambiguity that would require lookahead is resolved by a documented call (see below), which keeps the parser incremental, partial-safe, and tiny.

Companion to ultrahtml.

Entrypoints

| import | returns | deps | gzip | | --- | --- | --- | --- | | ultramark | HTML strings | none | ~1.5 KB | | ultramark/ast | ultrahtml Documents (transforms, frameworks) | ultrahtml | +60 B | | ultramark/dom | DocumentFragments (browser) | none | +110 B |

Usage

import { createParser, parse } from 'ultramark';

// One-shot
parse('# Hello **world**'); // => '<h1>Hello <strong>world</strong></h1>\n'

// Streaming: push() returns HTML for blocks completed by that chunk.
// Output is stable and append-only — safe to stream straight into the DOM.
const p = createParser();
for await (const chunk of stream) {
  target.innerHTML = stableHTML + p.peek(); // tentative in-flight block
  stableHTML += p.push(chunk);              // newly closed blocks
}
stableHTML += p.end(); // flush
  • push(chunk): string — HTML for blocks closed by this chunk. A block is only emitted once it's complete, so stable output is always well-formed.
  • peek(): string — tentative render of the currently-open block (including the buffered partial line). Optimistic and syntax-free: unterminated constructs render as open elements (**bol<strong>bol</strong>, `co`<code>co</code>, [text](https://exa → a partial link), and still-resolving syntax is withheld entirely — trailing marker runs (about **about ), partial line-start markers (-, 1., ` `), partial checkboxes, and pipe-first paragraphs (tables-in-progress). peek never shows raw markdown syntax; content that turns out literal pops in, corrected, at close. Stable output is never affected.
  • end(): string — flush the remaining buffer and any open block.

ultramark/ast

import { createASTParser, parseAST } from 'ultramark/ast';
import { transformSync, walkSync } from 'ultrahtml';

// Same streaming contract, but each delta is an ultrahtml Document.
// Render to vnodes in your framework, or transform before rendering:
const out = transformSync(parseAST(md), [
  (doc) => (walkSync(doc, (n) => { if (n.name === 'a') n.attributes.rel = 'noopener'; }), doc),
]);

ultramark/dom

import { createDOMParser } from 'ultramark/dom';

const p = createDOMParser((el) => {
  if (el.tagName === 'A') el.setAttribute('target', '_blank');
});
target.append(p.push(chunk)); // DocumentFragment per delta

Supported subset

  • Blocks: ATX headings (#######), paragraphs, fenced code (```/~~~, info string → class="language-x"), bulleted/ordered lists (indent-nested, <ol start>), blockquotes (nestable, full block support via a recursive parser), thematic breaks, GFM tables (with align), task lists
  • Inline: *em*, **strong**, ***both***, ~~del~~, `code`, [links](url), ![images](url), bare-URL autolinks
  • Safe by default: all raw HTML is escaped; javascript:/vbscript: URLs are neutralized

Subset calls (intentionally not CommonMark)

Each of these removes a lookahead that would break incremental streaming:

| Input | Renders as | Why | | --- | --- | --- | | Title\n--- | paragraph + <hr> | setext headings need 1-line lookahead | | Title\n=== | paragraph with === text | same | | 4-space indent | paragraph text | indented code conflicts with list continuation; agents use fences | | <div> | escaped text | raw HTML is a security hole for untrusted output | | _em_ | literal | _ emphasis breaks on snake_case | | [text][ref] | literal | reference definitions can appear after use (whole-doc lookahead) | | hard breaks ( \n) | plain newline | bytes | | entities | passed through untouched (never double-escaped) | a decoder table costs more than it's worth | | list item continuation lines | new paragraph | items are single-line + nested lists only | | fences interrupting lists | closes the list | keeps fence state single-level |

Development

pnpm install
pnpm test    # vitest — includes chunk-invariance streaming tests
pnpm build   # esbuild + terser, prints per-entrypoint byte sizes
pnpm bench   # mitata vs markdown-wasm/marked/markdown-it/commonmark.js
pnpm demo    # → http://localhost:3000 — simulated token stream into the DOM

The demo (demo/index.html) renders a simulated LLM stream with ultramark/dom: stable blocks append once, and the dimmed tail is peek() — the only region that ever re-renders.