Markstream Migration
Overview
Replace an existing Markdown renderer without silently dropping transforms, custom components, URL policy, raw-HTML behavior, or streaming semantics. Read references/adoption-checklist.md first.
When to Use
Use when replacing react-markdown, markdown-it, marked, or another renderer; migrating node renderers; or choosing between Markstream content, smooth streaming, and nodes.
Workflow
Before changing dependencies or source files, inspect the existing package manager and project conventions, preview the intended edits, and obtain explicit user approval.
- Inventory renderer imports, call sites, plugins, HTML policy, URL transforms, allowlists, custom renderers, CSS, and tests.
- Classify the migration as direct, renderer-custom, plugin-heavy, or security-heavy.
- Install the framework package and explicit CSS. Preserve visible behavior before optional features.
- Map built-ins to scoped overrides; in React prefer renderer-local component maps.
- Use trusted custom tags only for trusted content and reserve parse transforms for irreducible token/AST requirements.
- Keep
content with smooth streaming for ordinary token streams. Use nodes only for worker parsing, shared AST ownership, or structural transforms.
- Preserve safe HTML and strict Mermaid defaults; scope and document any trusted legacy exception.
- Run relevant builds and behavior tests. Report mappings, intentional differences, and unresolved review.
Example
// Before:
// import ReactMarkdown from 'react-markdown'
// return <ReactMarkdown>{markdown}</ReactMarkdown>
import MarkdownRender from 'markstream-react'
import 'markstream-react/index.css'
export function AssistantAnswer({
markdown,
isDone,
}: {
markdown: string
isDone: boolean
}) {
return (
<MarkdownRender
content={markdown}
final={isDone}
fade={isDone}
typewriter={!isDone}
smoothStreaming={isDone ? false : 'auto'}
htmlPolicy="safe"
/>
)
}
Limitations
- Markstream cannot reproduce every remark, rehype, or markdown-it plugin automatically.
- Visual parity does not prove security or URL-policy parity.
- Large migrations may require staged conversion.
Security & Safety Notes
Do not weaken sanitization for screenshot parity. Review dependencies, raw HTML, URL transforms, and trust boundaries explicitly.
1---2name: markstream-migration3description: "Audit and migrate an existing Markdown renderer to Markstream while preserving custom renderers, security policy, streaming behavior, and explicit parity gaps."4category: frontend5risk: critical6source: https://github.com/Simon-He95/markstream-vue/tree/main/.agents/skills/markstream-migration7source_repo: Simon-He95/markstream-vue8source_type: official9date_added: "2026-07-21"10author: Simon-He9511tags: [markdown, migration, streaming, security, frontend]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-migration17---1819# Markstream Migration2021## Overview2223Replace an existing Markdown renderer without silently dropping transforms, custom components, URL policy, raw-HTML behavior, or streaming semantics. Read [references/adoption-checklist.md](references/adoption-checklist.md) first.2425## When to Use2627Use when replacing `react-markdown`, `markdown-it`, `marked`, or another renderer; migrating node renderers; or choosing between Markstream `content`, smooth streaming, and `nodes`.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. Inventory renderer imports, call sites, plugins, HTML policy, URL transforms, allowlists, custom renderers, CSS, and tests.342. Classify the migration as direct, renderer-custom, plugin-heavy, or security-heavy.353. Install the framework package and explicit CSS. Preserve visible behavior before optional features.364. Map built-ins to scoped overrides; in React prefer renderer-local component maps.375. Use trusted custom tags only for trusted content and reserve parse transforms for irreducible token/AST requirements.386. Keep `content` with smooth streaming for ordinary token streams. Use `nodes` only for worker parsing, shared AST ownership, or structural transforms.397. Preserve safe HTML and strict Mermaid defaults; scope and document any trusted legacy exception.408. Run relevant builds and behavior tests. Report mappings, intentional differences, and unresolved review.4142## Example4344```tsx45// Before:46// import ReactMarkdown from 'react-markdown'47// return <ReactMarkdown>{markdown}</ReactMarkdown>4849import MarkdownRender from 'markstream-react'50import 'markstream-react/index.css'5152export function AssistantAnswer({53 markdown,54 isDone,55}: {56 markdown: string57 isDone: boolean58}) {59 return (60 <MarkdownRender61 content={markdown}62 final={isDone}63 fade={isDone}64 typewriter={!isDone}65 smoothStreaming={isDone ? false : 'auto'}66 htmlPolicy="safe"67 />68 )69}70```7172## Limitations7374- Markstream cannot reproduce every remark, rehype, or markdown-it plugin automatically.75- Visual parity does not prove security or URL-policy parity.76- Large migrations may require staged conversion.7778## Security & Safety Notes7980Do not weaken sanitization for screenshot parity. Review dependencies, raw HTML, URL transforms, and trust boundaries explicitly.