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

semidown

v0.0.3

Published

A semi-incremental streaming markdown parser and renderer for the web, designed for real-time applications such as chat UIs, live documentation, and collaborative editors.

Readme

Semidown

A semi-incremental streaming markdown parser and renderer for the web, designed for real-time applications such as chat UIs, live documentation, and collaborative editors.

Try the live demo!

Install

npm install semidown

Usage

Below is a simplified usage example. See src/main.ts for a full-featured demo with UI controls.

import { Semidown } from "semidown";

const outputContainer = document.getElementById("output");
const parser = new Semidown(outputContainer);

// Simulate streaming input
const markdown = "# Hello\nThis is a **streaming** demo.";
let idx = 0;
const interval = setInterval(() => {
  if (idx < markdown.length) {
    parser.write(markdown[idx++]);
  } else {
    parser.end();
    clearInterval(interval);
  }
}, 50);

Key Features

  • Semi-incremental Parsing:
    • Block-level incremental: As new markdown text arrives (e.g., from a stream), the parser incrementally processes and renders new blocks (paragraphs, lists, code blocks, tables, etc.) without reprocessing the entire document.
    • Inline-level re-rendering: Within a block, inline elements (bold, italics, links, code spans, etc.) are re-rendered as the block's content grows. This design ensures robust and correct inline rendering, even as partial input arrives.
  • Streaming Support: Feed markdown text in arbitrary chunks (e.g., as it arrives from a network or user input) and see the output update in real time.
  • Pause, Resume, and Fast-forward: Control the streaming process for demos, testing, or user interaction.
  • Performance & Robustness: The semi-incremental approach balances efficient updates with correct rendering, avoiding flicker or broken formatting as content streams in.

How It Works

  • The parser maintains state as new markdown text is written.
  • When a complete block is detected, it is parsed and rendered immediately.
  • If a block is incomplete (e.g., a code block or list is still being typed), it is held and re-parsed as more text arrives.
  • Inline elements within a block are always re-parsed on each update to ensure correctness.

Sample App

The included demo (src/main.ts) provides a UI to:

  • Start, pause, resume, and stop streaming markdown input
  • See real-time updates as markdown is parsed and rendered
  • Experiment with different markdown features (lists, code, tables, etc.)

Design Rationale

  • Why semi-incremental?
    • Full incremental parsing at the inline level is complex and error-prone, especially with partial tokens and nested formatting.
    • By incrementally parsing at the block level and re-rendering inlines, the library achieves a robust balance: fast updates for new blocks, and correct inline formatting as content grows.

License

MIT