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

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

可直接粘贴的消息

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

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

  1. Inventory renderer imports, call sites, plugins, HTML policy, URL transforms, allowlists, custom renderers, CSS, and tests.
  2. Classify the migration as direct, renderer-custom, plugin-heavy, or security-heavy.
  3. Install the framework package and explicit CSS. Preserve visible behavior before optional features.
  4. Map built-ins to scoped overrides; in React prefer renderer-local component maps.
  5. Use trusted custom tags only for trusted content and reserve parse transforms for irreducible token/AST requirements.
  6. Keep content with smooth streaming for ordinary token streams. Use nodes only for worker parsing, shared AST ownership, or structural transforms.
  7. Preserve safe HTML and strict Mermaid defaults; scope and document any trusted legacy exception.
  8. 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.

repo: sickn33/agentic-awesome-skills

热度

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

这个技能有用吗?

0

登录 后即可投票。

评论

  • …

同一仓库的更多技能

相似技能