跳到正文
Skillpedia
网站与界面(前端)48k · #5172

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。它会读取这个技能并按说明操作。

可直接粘贴的消息

请用这个技能帮我:https://github.com/sickn33/agentic-awesome-skills/blob/main/plugins/agentic-awesome-skills-claude/skills/markstream-react/SKILL.md 阅读该链接中的 SKILL.md 文件,并在我的任务中按照它的说明来做。
想让你的 AI 自己找到这样的技能吗?安装免费的 Skillpedia MCP:只需一行,每次任务前它都会在 15,000+ 个技能中搜索。1 分钟完成安装 →

可以这样问 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.

  1. Confirm React 18+ and acceptance of a beta package.
  2. Install only requested peers and import markstream-react/index.css.
  3. Use the root entry for client rendering, /next for Next-specific components, and /server for server rendering without client hooks.
  4. Start with content and smoothStreaming="auto"; use nodes plus final only when another layer owns parsing.
  5. For live chat disable fade and opt into the cursor. On completion set final, disable pacing/cursor, and enable fade only if desired.
  6. Keep browser-only peers inside 'use client', dynamic ssr: false, or another minimal boundary.
  7. Prefer streamingComponents for parser-backed tags and htmlComponents for sanitized props. Use scoped registry overrides for built-in nodes.
  8. 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.

repo: sickn33/agentic-awesome-skills

热度

GitHub 星标
48k
排名
#5172
许可证
MIT
更新时间
2026/10/15

这个技能有用吗?

0

登录 后即可投票。

评论

  • …

同一仓库的更多技能

相似技能