A semi-incremental streaming markdown parser and renderer for the web, designed for handling LLM streaming out.
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);