markstream-migration
它能做什么
这个工具可以帮你把现有的、用于显示格式化文本(例如用星号表示加粗的文本)的程序替换为新的 Markstream。它能确保一切照常运行,包括自定义部分和安全规则。
适用场景
- ✓替换 'react-markdown' 或 'markdown-it' 等程序时。
- ✓迁移用于显示格式化文本的组件时。
- ✓选择用 Markstream 显示文本的最佳方式时。
技能链接
https://github.com/sickn33/agentic-awesome-skills/blob/main/plugins/agentic-awesome-skills-claude/skills/markstream-migration/SKILL.md复制后粘贴给你的 AI(Claude、ChatGPT 或 Cursor),让它按照说明操作。
使用方法
最简单的方法:复制下面的消息,粘贴给你的 AI。它会读取这个技能并按说明操作。
可直接粘贴的消息
适用于 Claude Code、Codex 或 Cursor:在项目文件夹中运行,即可安装该技能。
下载 SKILL.md,放进智能体的技能文件夹。
可以这样问 AI
“我想把当前的格式化文本显示程序切换为 Markstream,并保留自定义功能和安全设置。”
每周 5 个新技能,1 分钟读完。
工作原理
工具会分析你当前程序的文本显示方式,找出重要的部分(比如自定义功能和安全规则),然后帮你配置 Markstream 以实现相同效果。它重点关注保持可见的表现和安全性。
技术内容(原始 SKILL.md)
作者在 GitHub 上的英文原文。
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
contentwith smooth streaming for ordinary token streams. Usenodesonly 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.
常见问题
什么是 Markdown 渲染器?
它是一种程序,能把用特殊格式(如 Markdown,使用“*”等符号表示加粗)书写的文本,转换成电脑可以在屏幕上直观显示的内容。
什么是自定义渲染器?
它们是文本显示程序中的自定义部分,用于以独特的方式显示某些非标准的元素。
“streaming behavior”是什么意思?
指文本在屏幕上逐步显示的方式,就像正在被打字输入一样,而不是一下子全部出现。
详情
作者的原始描述
Audit and migrate an existing Markdown renderer to Markstream while preserving custom renderers, security policy, streaming behavior, and explicit parity gaps.
热度
- GitHub 星标
- 48k
- 排名
- #5170
- 许可证
- MIT
- 更新时间
- 2026/10/15
评论
- …
同一仓库的更多技能
00-andruia-consultant
48k帮你的智能体启动或改进 AI 项目。它可以分析代码、推荐工具,并用西班牙语制定行动计划。
007
48k让你的智能体执行安全审计和威胁建模。它有助于保护项目免受攻击和漏洞的威胁。
10-andruia-skill-smith
48k帮你的智能体创建或改进 AI 工具。它可以定义工具的工作方式、编写文档,并验证其结构。
20-andruia-niche-intelligence
48k让你的智能体创建某个特定行业的摘要。它有助于借助可靠的信息来源,了解项目的背景、规则、使用模式和风险。