Show HN: Markstream – render incomplete Markdown from LLM streams
Markstream is a new Markdown renderer designed specifically for streaming LLM output. It handles unclosed code fences, tables, and Mermaid/KaTeX blocks during token generation, prevents flickering, and reduces re-rendering costs. The project offers packages for Vue, React, Svelte, Angular, and a standalone parser.
Background
- Markdown is a lightweight text formatting language (using symbols like `#` for headings, `*` for bold, backticks for code) widely used in developer tools. Most Markdown renderers (libraries that convert Markdown into formatted HTML) process finished text only.
- Large Language Models (LLMs) like ChatGPT "stream" their output token-by-token in real-time, so the user sees text appearing progressively rather than waiting for the full response. This means the rendering library must handle incomplete syntax — e.g., a code block started with ``` but not yet closed.
- Markstream is a new open-source library that solves this specific problem: it renders Markdown correctly even while tokens are still arriving. It supports multiple JavaScript web frameworks (Vue, React, Svelte, Angular) and handles edge cases like flickering diagrams (Mermaid, a tool that renders diagrams from text), flickering math equations (KaTeX), and expensive re-rendering of long AI responses.
- The project's creator is posting on Hacker News ("Show HN") which is the community's main venue for sharing new side projects and getting technical feedback.