Chuyển đến nội dung
Skillpedia
Website và giao diện (frontend)48k · #5168

markstream-custom-components

Skill này làm gì

Công cụ này cho phép bạn tùy chỉnh cách một số phần tử xuất hiện trong tài liệu văn bản có định dạng (như bài viết hoặc bài đăng). Bạn có thể thay đổi cách hiển thị hình ảnh, liên kết hoặc khối mã, hoặc thêm các phần tử đặc biệt của riêng bạn.

Khi nào nên dùng

  • ✓Khi bạn muốn thay đổi diện mạo mặc định của hình ảnh hoặc liên kết.
  • ✓Khi bạn muốn tạo một loại khối mới, như khối 'suy nghĩ'.
  • ✓Khi bạn cần các phần tử tùy chỉnh này chỉ hoạt động trong một phần cụ thể của website hoặc ứng dụng.

Liên kết skill

https://github.com/sickn33/agentic-awesome-skills/blob/main/plugins/agentic-awesome-skills-claude/skills/markstream-custom-components/SKILL.md

Sao chép rồi dán vào AI của bạn (Claude, ChatGPT hoặc Cursor) và nhờ nó làm theo hướng dẫn.

Cách dùng

Cách dễ nhất: sao chép tin nhắn và dán vào AI của bạn. AI sẽ đọc skill và làm theo hướng dẫn.

Tin nhắn có sẵn để dán

Hãy dùng skill này để giúp tôi: https://github.com/sickn33/agentic-awesome-skills/blob/main/plugins/agentic-awesome-skills-claude/skills/markstream-custom-components/SKILL.md Đọc tệp SKILL.md tại liên kết đó và làm theo hướng dẫn cho việc của tôi.
Bạn muốn AI tự tìm những skill như thế này?Cài MCP Skillpedia miễn phí: chỉ một dòng, và AI sẽ tìm trong 15.000+ skill trước mỗi việc.Cài đặt trong 1 phút →

Ví dụ cách nhờ AI

“Làm sao để các khối mã có màu nền khác?”

5 skill mới mỗi tuần. Đọc chỉ 1 phút.

Cách hoạt động

Bạn cho công cụ biết những phần tử nào muốn thay đổi và cách chúng nên hiển thị. Sau đó công cụ dùng các chỉ dẫn này để hiển thị văn bản, áp dụng các tùy chỉnh của bạn thay vì quy tắc mặc định.

Nội dung kỹ thuật (SKILL.md gốc)

Lấy nguyên văn từ GitHub, do tác giả viết bằng tiếng Anh.

Markstream Custom Components

Overview

Customize specific Markstream nodes or trusted custom tags without replacing the parser or leaking global renderer state. Read references/patterns.md first.

When to Use

Use to replace built-ins such as image, link, code_block, mermaid, or inline_code; render trusted tags such as thinking; or scope overrides to one renderer or app. Use parser transforms only when token or AST reshaping is required.

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. Classify the change as a built-in override, trusted tag, or parser transform.
  2. Prefer scoped mappings. Vue, Vue 2, Svelte, and Angular can use setCustomComponents(customId, mapping); Svelte and Angular can also pass renderer-local maps.
  3. In React, prefer streamingComponents for parser-backed nodes and htmlComponents for sanitized attributes plus children.
  4. Start with leaf nodes before containers that must preserve children.
  5. For trusted tag bodies containing Markdown, use a nested renderer with the same allowlist. Do not add a second smooth-streaming loop.
  6. Preserve node/loading props, identity keys, scope IDs, theme state, and preview-height estimates for async diagrams.
  7. Remove temporary scoped registrations on cleanup and validate repeated and nested tags.

Example

import MarkdownRender, {
  type NodeComponentProps,
  setCustomComponents,
} from 'markstream-react'
import 'markstream-react/index.css'

function ThinkingNode({ node }: NodeComponentProps<any>) {
  return <details><summary>Thinking</summary>{node.content}</details>
}

setCustomComponents('assistant-panel', { thinking: ThinkingNode })

export function Answer({ markdown }: { markdown: string }) {
  return (
    <MarkdownRender
      content={markdown}
      customId="assistant-panel"
      customHtmlTags={['thinking']}
      htmlPolicy="safe"
    />
  )
}

Limitations

  • Component overrides cannot reproduce arbitrary remark/rehype transforms.
  • Container overrides require careful child rendering and accessibility review.
  • Framework registration APIs are not interchangeable.

Security & Safety Notes

Treat custom HTML-like tags as trusted input only. Keep safe HTML enabled and do not pass unsanitized attributes into host components.

Câu hỏi thường gặp

Tôi có thể thay đổi những gì?

Bạn có thể thay đổi các phần tử tiêu chuẩn như hình ảnh và liên kết, hoặc thêm các phần tử mới đáng tin cậy. Tuy nhiên, bạn không thể làm lại toàn bộ các phép biến đổi định dạng phức tạp.

Dùng phần tử tùy chỉnh có an toàn không?

Có, miễn là bạn coi các phần tử này là đáng tin cậy và không đưa thông tin chưa được kiểm chứng vào trong đó. Điều quan trọng là giữ các cài đặt bảo mật được bật.

Điều này hoạt động thế nào với các công nghệ web khác nhau (Vue, React, v.v.)?

Công cụ cung cấp các cách thiết lập tùy chỉnh riêng cho từng công nghệ, đảm bảo chúng hoạt động đúng trong từng môi trường.

Chi tiết

Mô tả gốc của tác giả

Override Markstream node renderers and add trusted custom tags across Vue, React, Svelte, and Angular using scoped or renderer-local mappings.

repo: sickn33/agentic-awesome-skills

Độ phổ biến

Sao GitHub
48k
Vị trí xếp hạng
#5168
Giấy phép
MIT
Cập nhật
15/10/2026

Skill này có hữu ích không?

0

Đăng nhập để bình chọn.

Bình luận

  • …

Thêm skill từ kho mã này

Skill tương tự