Markstream React
Overview
Wire the beta React renderer into React 18+ or Next.js without crossing client/server boundaries or reaching for AST control unnecessarily.
When to Use
Use for React/Next setup, root/next/server entrypoints, streaming, component overrides, or migration support. Pair with markstream-migration for renderer replacement.
Workflow
Before changing dependencies or source files, inspect the existing package manager and project conventions, preview the intended edits, and obtain explicit user approval.
- Confirm React 18+ and acceptance of a beta package.
- Install only requested peers and import
markstream-react/index.css.
- Use the root entry for client rendering,
/next for Next-specific components, and /server for server rendering without client hooks.
- Start with
content and smoothStreaming="auto"; use nodes plus final only when another layer owns parsing.
- For live chat disable fade and opt into the cursor. On completion set
final, disable pacing/cursor, and enable fade only if desired.
- Keep browser-only peers inside
'use client', dynamic ssr: false, or another minimal boundary.
- Prefer
streamingComponents for parser-backed tags and htmlComponents for sanitized props. Use scoped registry overrides for built-in nodes.
- Keep
htmlPolicy="safe" and Mermaid strict; validate client, server, and incremental paths.
Example
import MarkdownRender from 'markstream-react'
import 'markstream-react/index.css'
export function StreamingAnswer({
content,
isDone,
}: {
content: string
isDone: boolean
}) {
return (
<MarkdownRender
content={content}
final={isDone}
fade={isDone}
typewriter={!isDone}
smoothStreaming={isDone ? false : 'auto'}
htmlPolicy="safe"
/>
)
}
Limitations
- The package is beta and requires React 18+.
- Browser-only peers require client boundaries under SSR.
- Complex parser parity requires separate migration review.
Security & Safety Notes
Review dependencies and never opt untrusted model output into trusted HTML or loose diagram rendering.
1---2name: markstream-react3description: "Integrate the beta markstream-react renderer into React 18+ or Next.js with correct client/server entrypoints, CSS, streaming state, and component overrides."4category: frontend5risk: critical6source: https://github.com/Simon-He95/markstream-vue/tree/main/.agents/skills/markstream-react7source_repo: Simon-He95/markstream-vue8source_type: official9date_added: "2026-07-21"10author: Simon-He9511tags: [react, nextjs, markdown, streaming, ssr]12tools: [claude, cursor, gemini, codex]13license: MIT14license_source: https://github.com/Simon-He95/markstream-vue/blob/main/license15metadata:16 source: https://skillmd.com/skills/mhassan0000/markstream-react17---1819# Markstream React2021## Overview2223Wire the beta React renderer into React 18+ or Next.js without crossing client/server boundaries or reaching for AST control unnecessarily.2425## When to Use2627Use for React/Next setup, root/`next`/`server` entrypoints, streaming, component overrides, or migration support. Pair with `markstream-migration` for renderer replacement.2829## Workflow3031Before changing dependencies or source files, inspect the existing package manager and project conventions, preview the intended edits, and obtain explicit user approval.32331. Confirm React 18+ and acceptance of a beta package.342. Install only requested peers and import `markstream-react/index.css`.353. Use the root entry for client rendering, `/next` for Next-specific components, and `/server` for server rendering without client hooks.364. Start with `content` and `smoothStreaming="auto"`; use `nodes` plus `final` only when another layer owns parsing.375. For live chat disable fade and opt into the cursor. On completion set `final`, disable pacing/cursor, and enable fade only if desired.386. Keep browser-only peers inside `'use client'`, dynamic `ssr: false`, or another minimal boundary.397. Prefer `streamingComponents` for parser-backed tags and `htmlComponents` for sanitized props. Use scoped registry overrides for built-in nodes.408. Keep `htmlPolicy="safe"` and Mermaid strict; validate client, server, and incremental paths.4142## Example4344```tsx45import MarkdownRender from 'markstream-react'46import 'markstream-react/index.css'4748export function StreamingAnswer({49 content,50 isDone,51}: {52 content: string53 isDone: boolean54}) {55 return (56 <MarkdownRender57 content={content}58 final={isDone}59 fade={isDone}60 typewriter={!isDone}61 smoothStreaming={isDone ? false : 'auto'}62 htmlPolicy="safe"63 />64 )65}66```6768## Limitations6970- The package is beta and requires React 18+.71- Browser-only peers require client boundaries under SSR.72- Complex parser parity requires separate migration review.7374## Security & Safety Notes7576Review dependencies and never opt untrusted model output into trusted HTML or loose diagram rendering.