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

@a5omic/flowdown

v0.1.2

Published

O(1) streaming markdown renderer for the AI era. Zero dependencies.

Readme

flowdown

npm version license bundle size

O(1) streaming markdown renderer for the AI era. Zero dependencies. ~4KB gzipped.

Every AI chat app using react-markdown re-parses the entire conversation on every token. That's O(n²). Flowdown processes each token exactly once. That's O(n).

Performance

| Benchmark | Flowdown | marked | markdown-it | |-----------|----------|--------|-------------| | Streaming (2K tokens) | 7.8ms | 16,765ms | — | | DOM output (9KB) | 7.3ms | 13.4ms | 12.9ms | | String output (9KB) | 0.77ms | 1.00ms | 0.87ms | | Bundle (gzipped) | ~4KB | 12KB | 51KB |

Flowdown is 2,146x faster than marked for streaming the same document.

Install

npm install @a5omic/flowdown

Usage

import { Flowdown } from '@a5omic/flowdown';

const renderer = new Flowdown({
  container: document.getElementById('output'),
});

// Stream tokens as they arrive from the LLM
for await (const chunk of stream) {
  renderer.push(chunk);
}
renderer.end();

React

npm install @a5omic/flowdown @a5omic/flowdown-react
import { StreamMarkdown } from '@a5omic/flowdown-react';

function ChatMessage({ content }: { content: string }) {
  return <StreamMarkdown content={content} />;
}

Static Rendering

const html = Flowdown.renderToString('# Hello **world**');
// → '<h1>Hello <strong>world</strong></h1>'

With Syntax Highlighting

import { Flowdown } from '@a5omic/flowdown';
import hljs from 'highlight.js';

const renderer = new Flowdown({
  container: document.getElementById('output'),
  highlight: (code, lang) => {
    if (lang && hljs.getLanguage(lang)) {
      return hljs.highlight(code, { language: lang }).value;
    }
    return code;
  },
});

Viewport Virtualization

For long LLM responses, enable virtualization to keep DOM node count flat:

const renderer = new Flowdown({
  container: document.getElementById('output'),
  virtualize: true,
  overscan: 2,
});

Off-screen blocks are replaced with height-matched spacers. Scrolling back materializes them from cache.

How It Works

Traditional markdown renderers parse the entire input into an AST, then render the full AST to DOM on every update. During LLM streaming, this means O(n²) total work.

Flowdown uses an incremental state machine parser that:

  1. Only processes new characters (never re-parses old content)
  2. Emits minimal DOM operations directly (no intermediate AST)
  3. Batches DOM writes per animation frame
  4. Handles incomplete markdown gracefully (FOIM prevention)
  5. Virtualizes off-screen blocks to keep DOM node count constant

Read RESEARCH.md for the full technical deep dive.

API

new Flowdown(options)

| Option | Type | Default | Description | |--------|------|---------|-------------| | container | HTMLElement | required | DOM element to render into | | highlight | (code, lang) => string \| Promise<string> | — | Syntax highlighter for completed code blocks | | onCodeBlock | (code, lang) => void | — | Callback when a code block completes | | sanitize | boolean | true | Sanitize URLs (XSS prevention) | | virtualize | boolean | false | Enable viewport virtualization | | overscan | number | 2 | Blocks to keep rendered outside viewport |

Instance Methods

  • push(chunk) — Process a chunk of streaming markdown
  • flush() — Materialize the unfinished trailing line without ending the stream
  • end() — Signal end of stream, flush buffered content
  • reset() — Clear all state and output, ready for reuse
  • destroy() — Clean up all resources
  • getViewportStats() — Returns { total, visible, virtualized } block counts

Static Methods

  • Flowdown.renderToString(markdown) — Parse markdown to HTML string (no DOM required)

Supported Markdown

Flowdown targets "LLM markdown" — the subset that AI models actually output:

  • Headings (# ## ### ####)
  • Bold, italic, strikethrough, inline code
  • Fenced code blocks with language hints
  • Links and images (inline syntax)
  • Unordered and ordered lists
  • Blockquotes (including nested code blocks)
  • GFM pipe tables with column alignment
  • Horizontal rules

Intentionally not supported (not used by LLMs): reference links, setext headings, indented code blocks, HTML blocks.

License

MIT