Registry / web-framework / streaming-markdown

streaming-markdown

JSON →
library0.2.15jsnpmunverified

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.

npm install streaming-markdown
INSTALL
IMPORT
SIG · STREAMING-MARKDOWN
S
streaming-markdown
web-frameworkjavascriptv0.2.15
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

parser
import { parser } from 'streaming-markdown'
import parser from 'streaming-markdown'
ESM-only module, default export is not available. Use named imports.
default_renderer
import { default_renderer } from 'streaming-markdown'
const { default_renderer } = require('streaming-markdown')
CommonJS require() not supported; use ESM imports.
parser_write
import { parser_write } from 'streaming-markdown'
import { write } from 'streaming-markdown'
Function is named parser_write, not write. Check documentation for exact exports.

Demonstrates creating a parser with default_renderer, writing markdown chunks, and ending the stream.

import * as smd from 'streaming-markdown'; const element = document.getElementById('output'); const renderer = smd.default_renderer(element); const parser = smd.parser(renderer); smd.parser_write(parser, "# Hello "); smd.parser_write(parser, "World\n\n"); smd.parser_write(parser, "This is **bold** and *italic* text."); smd.parser_end(parser);
Debug
Known issues
gotchaParser is experimental; markdown features may be incomplete or behave unexpectedly.
fix
Check the GitHub README for supported features before relying on it in production.
affects: >=0.2.15
breakingIn v0.0.15, the attribute for code blocks changed from 'lang' to 'class'. Custom renderers relying on 'lang' will break.
fix
Update custom renderers to use 'class' attribute for language.
affects: >=0.0.15
gotchaNode >=20 required. Older versions will cause runtime errors.
fix
Upgrade Node.js to version 20 or later.
affects: >=0.2.0
gotchaThe package is ESM-only; CommonJS require() will fail.
fix
Use import statements or switch to ESM in your project.
affects: >=0.2.0
Errors
Common errors & fixes
SyntaxError: The requested module 'streaming-markdown' does not provide an export named 'default'
Trying to default import from an ESM-only module that only exports named exports.
fix
Use named imports: import { parser } from 'streaming-markdown'
Error: Cannot find module 'streaming-markdown'
Package not installed or running in an unsupported environment (e.g., Node <20).
fix
Install with npm install streaming-markdown and ensure Node >=20.
TypeError: smd.default_renderer is not a function
Importing wrong symbol or using a version prior to v0.0.15 where the function existed.
fix
Verify the correct import: import { default_renderer } from 'streaming-markdown'
Upgrade
Version history
0.2.15latest on npm
Audit
Dependencies

No dependency data recorded yet.

Agent activity
7 hits · last 30 days
node
6
OpenAI (training)
1
Resources
streaming-markdown — npm install streaming-markdown · libregistry