markstream-react
它能做什么
这个工具可以帮你把名为 'markstream-react' 的新功能集成到使用 React 18 或 Next.js 的项目中。它能确保浏览器端与服务器端之间正常协作,并允许你自定义内容的显示方式。
适用场景
- ✓搭建新的 React 18 或 Next.js 项目时。
- ✓当你需要显示逐步到达的内容(流式传输)时。
- ✓替换或更新内容的渲染方式时。
技能链接
https://github.com/sickn33/agentic-awesome-skills/blob/main/plugins/agentic-awesome-skills-claude/skills/markstream-react/SKILL.md复制后粘贴给你的 AI(Claude、ChatGPT 或 Cursor),让它按照说明操作。
使用方法
最简单的方法:复制下面的消息,粘贴给你的 AI。它会读取这个技能并按说明操作。
可直接粘贴的消息
适用于 Claude Code、Codex 或 Cursor:在项目文件夹中运行,即可安装该技能。
下载 SKILL.md,放进智能体的技能文件夹。
可以这样问 AI
“我怎样在 Next.js 项目中设置 markstream-react,以逐步显示文本?”
每周 5 个新技能,1 分钟读完。
工作原理
工具会管理运行在你电脑(客户端)上的代码与运行在服务器上的代码之间的衔接。它为每个部分使用特定的文件(客户端/服务端入口),并处理外观(CSS)以及逐步到达内容的状态。
技术内容(原始 SKILL.md)
作者在 GitHub 上的英文原文。
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
Inspect the existing package manager, installed package version and project conventions. A requested scoped integration already authorizes routine source/dependency edits; seek approval only for a material scope expansion or unresolved beta/alpha adoption decision.
- 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,
/nextfor Next-specific components, and/serverfor server rendering without client hooks. - Start with
contentandsmoothStreaming="auto"; usenodesplusfinalonly 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', dynamicssr: false, or another minimal boundary. - Prefer
streamingComponentsfor parser-backed tags andhtmlComponentsfor sanitized props. Use scoped registry overrides for built-in nodes. - Keep
htmlPolicy="safe"and Mermaid strict; validate client, server, and incremental paths.
Example
'use client' // Required when this example is used in a Next.js App Router client boundary
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.
Verify props, export paths and peer ranges against the installed package, not a mutable upstream main. Test partial and completed streams, malformed/untrusted Markdown, links and image URLs, cancellation and reduced motion. Safe HTML and strict diagrams reduce exposure but do not alone enforce URL/network privacy or application component permissions.
常见问题
“beta”是什么意思?
beta 表示该功能仍处于测试阶段。它可能存在一些问题,但对于大多数用途来说已经可以正常使用。
我必须使用 React 18 吗?
是的,这个工具是为 React 18 或更新版本以及 Next.js 设计的。
什么是 client/server entrypoints(客户端/服务端入口)?
这是代码中不同的起始点。一个用于在用户浏览器中运行的部分(客户端),另一个用于在托管网站的服务器上运行的部分(服务端)。
详情
作者的原始描述
Integrate the beta markstream-react renderer into React 18+ or Next.js with correct client/server entrypoints, CSS, streaming state, and component overrides.
热度
- GitHub 星标
- 48k
- 排名
- #5172
- 许可证
- MIT
- 更新时间
- 2026/10/15
评论
- …
同一仓库的更多技能
00-andruia-consultant
48k帮你的智能体启动或改进 AI 项目。它可以分析代码、推荐工具,并用西班牙语制定行动计划。
007
48k让你的智能体执行安全审计和威胁建模。它有助于保护项目免受攻击和漏洞的威胁。
10-andruia-skill-smith
48k帮你的智能体创建或改进 AI 工具。它可以定义工具的工作方式、编写文档,并验证其结构。
20-andruia-niche-intelligence
48k让你的智能体创建某个特定行业的摘要。它有助于借助可靠的信息来源,了解项目的背景、规则、使用模式和风险。