SolidJS streaming Markdown renderer
markstream-solid renders growing Markdown with native Solid components. It shares the parser and core with Vue 3, including smooth streaming, diff previews, code layout contracts, and diagram utilities. The Solid guide covers installation, compiler setup, and complete examples.
When to use it
- AI chat, SSE, or WebSocket output in a SolidJS 1.9 application
- Incomplete Markdown and code fences while input is arriving
- Mermaid, KaTeX, D2, infographic, and enhanced code blocks
- Custom Solid components and request-scoped configuration
- Long documents, virtual conversation histories, SSR, and hydration
For a normal stream, pass accumulated content and set final at completion. Use non-empty nodes when your app already owns the AST; an empty array falls back to content.
Quick start
Install in a SolidJS 1.9 / SolidStart application:
pnpm add markstream-solid solid-js@^1.9Run the repository demo:
pnpm install
pnpm build:solid
pnpm play:solidInside a configured Solid application:
import MarkdownRender from 'markstream-solid'
import 'markstream-solid/index.css'
export function Message(props: { content: string, done: boolean }) {
return <MarkdownRender mode="chat" content={props.content} final={props.done} />
}Keep prop reads in JSX/accessors. See installation and compiler setup for workspace/tarball consumption, Vite, and TypeScript settings.
Optional features
| Peer | Enables |
|---|---|
stream-diffs | Enhanced code blocks and diffs; native pre fallback while loading |
katex | Math, with katex/dist/katex.min.css |
mermaid | Mermaid diagrams |
@terrastruct/d2 | D2 diagrams |
@antv/infographic | Infographic blocks, enabled through enableInfographic |
Plain Markdown requires none of these optional peers. Import one renderer stylesheet explicitly; pixel and Tailwind CSS entries are available.
Solid bindings and maturity
MarkstreamProviderscopes components, translations, and language icons.- Callbacks and JSX/render props provide events and header slots.
- Renderer refs expose virtual-state capture/restore and scroll methods.
MarkstreamVirtualTimelineprovides native Solid conversation windows.- SSR uses the root package's conditional export; browser enhancements start on the client.
- The native implementation has unit, SSR, packed-consumer, browser, geometry, and performance validation.