{"id":28306,"library":"streaming-markdown","title":"streaming-markdown","description":"Streaming Markdown parser for incremental rendering of markdown as it's written, targeting AI chat-style outputs. Current version 0.2.15. Actively developed with experimental features. Ships TypeScript types. Key differentiator: optimistic parsing – immediately renders partial tokens (e.g., inline code, bold) without waiting for closing markers, supporting selectable text during streaming. The library exposes a custom Renderer interface for DOM control, with built-in default renderer and logger renderer. Minimal bundle size (~3 kB gzipped). Requires Node >=20 for server-side use.","status":"active","version":"0.2.15","language":"javascript","source_language":"en","source_url":"https://github.com/thetarnav/streaming-markdown","tags":["javascript","markdown","parser","html","ai","typescript"],"install":[{"cmd":"npm install streaming-markdown","lang":"bash","label":"npm"},{"cmd":"yarn add streaming-markdown","lang":"bash","label":"yarn"},{"cmd":"pnpm add streaming-markdown","lang":"bash","label":"pnpm"}],"dependencies":[],"imports":[{"note":"ESM-only module, default export is not available. Use named imports.","wrong":"import parser from 'streaming-markdown'","symbol":"parser","correct":"import { parser } from 'streaming-markdown'"},{"note":"CommonJS require() not supported; use ESM imports.","wrong":"const { default_renderer } = require('streaming-markdown')","symbol":"default_renderer","correct":"import { default_renderer } from 'streaming-markdown'"},{"note":"Function is named parser_write, not write. Check documentation for exact exports.","wrong":"import { write } from 'streaming-markdown'","symbol":"parser_write","correct":"import { parser_write } from 'streaming-markdown'"}],"quickstart":{"code":"import * as smd from 'streaming-markdown';\n\nconst element = document.getElementById('output');\nconst renderer = smd.default_renderer(element);\nconst parser = smd.parser(renderer);\n\nsmd.parser_write(parser, \"# Hello \");\nsmd.parser_write(parser, \"World\\n\\n\");\nsmd.parser_write(parser, \"This is **bold** and *italic* text.\");\nsmd.parser_end(parser);","lang":"typescript","description":"Demonstrates creating a parser with default_renderer, writing markdown chunks, and ending the stream."},"warnings":[{"fix":"Check the GitHub README for supported features before relying on it in production.","message":"Parser is experimental; markdown features may be incomplete or behave unexpectedly.","severity":"gotcha","affected_versions":">=0.2.15"},{"fix":"Update custom renderers to use 'class' attribute for language.","message":"In v0.0.15, the attribute for code blocks changed from 'lang' to 'class'. Custom renderers relying on 'lang' will break.","severity":"breaking","affected_versions":">=0.0.15"},{"fix":"Upgrade Node.js to version 20 or later.","message":"Node >=20 required. Older versions will cause runtime errors.","severity":"gotcha","affected_versions":">=0.2.0"},{"fix":"Use import statements or switch to ESM in your project.","message":"The package is ESM-only; CommonJS require() will fail.","severity":"gotcha","affected_versions":">=0.2.0"}],"env_vars":null,"last_verified":"2026-05-09T00:00:00.000Z","next_check":"2026-08-07T00:00:00.000Z","problems":[{"fix":"Use named imports: import { parser } from 'streaming-markdown'","cause":"Trying to default import from an ESM-only module that only exports named exports.","error":"SyntaxError: The requested module 'streaming-markdown' does not provide an export named 'default'"},{"fix":"Install with npm install streaming-markdown and ensure Node >=20.","cause":"Package not installed or running in an unsupported environment (e.g., Node <20).","error":"Error: Cannot find module 'streaming-markdown'"},{"fix":"Verify the correct import: import { default_renderer } from 'streaming-markdown'","cause":"Importing wrong symbol or using a version prior to v0.0.15 where the function existed.","error":"TypeError: smd.default_renderer is not a function"}],"ecosystem":"npm","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}