markdown
БесплатноБез исполняемых скриптовНе проверенRenders assistant message text as markdown in assistant-ui. Use when wiring MarkdownTextPrimitive or the markdown-text element into MessagePrimitive.Parts…
от assistant-ui★ 30 звёзд на GitHubОб этом скилле
assistant-ui Markdown
Always consult assistant-ui.com/llms.txt for the latest API.
Assistant-ui has two renderers for an assistant text part. MarkdownTextPrimitive is the lightweight react-markdown path and the installed MarkdownText element is its styled implementation. StreamdownTextPrimitive is the alternative when block-aware streaming and optional Shiki, KaTeX, Mermaid, or CJK support are worth the larger renderer.
References
- ./references/markdown-text.md -- install and compose
MarkdownText, customizeMarkdownTextPrimitive, and distinguish inline from fenced code - ./references/syntax-highlighting.md -- install the Shiki or Prism renderer and select one per fenced language
- ./references/latex-mermaid.md -- configure KaTeX, normalize model math, preserve code spans, and gate Mermaid on stream completion
- ./references/streamdown.md -- use the Streamdown alternative, plugins, Tailwind sources, and deferred parsing
Choose the renderer
Use markdown-text when the app needs a small renderer, a custom react-markdown component map, or per-language SyntaxHighlighter and CodeHeader overrides. Add highlighting, math, and Mermaid only when the message format requires them.
Use StreamdownTextPrimitive when a text part needs block-based streaming, incomplete markdown repair, or the optional code, math, Mermaid, and CJK plugins. It replaces the markdown renderer for that text part. Do not mount both renderers for the same part.
Install and wire MarkdownText
Install the renderer, which lands at components/assistant-ui/elements/markdown-text.tsx.
npx assistant-ui@latest add markdown-text
MarkdownText reads the active message part itself. Render it only in the text branch, while other part kinds keep their own renderers.
"use client";
import { MessagePrimitive } from "@assistant-ui/react";
import { MarkdownText } from "@/components/assistant-ui/elements/markdown-text";
export function AssistantMessageText() {
return (
<MessagePrimitive.Parts>
{({ part }) => (part.type === "text" ? <MarkdownText /> : null)}
</MessagePrimitive.Parts>
);
}
The thread element already includes this renderer. Compose it directly only when replacing the thread's message layout.
Customize the primitive
MarkdownTextPrimitive reads the surrounding text part through context, so it receives no text child or value prop. Its components map controls normal markdown tags plus SyntaxHighlighter and CodeHeader; componentsByLanguage replaces either slot for one fenced language. See markdown-text.md for a direct primitive implementation.
preprocess runs on the full accumulated text before smoothing and parsing. It is the seam for model-specific delimiter repair. smooth defaults to true; defer defaults to false. Set defer for large, rapidly growing messages when React should prioritize input and scrolling over intermediate parses. Keep its value constant while the renderer is mounted because toggling it remounts the parsed tree.
Highlight fenced code
MarkdownText displays fenced code as plain code until a SyntaxHighlighter is registered. Prefer the runtime-aware Shiki element, which waits for its active part to settle before tokenizing.
npx assistant-ui@latest add shiki-highlighter
import { SyntaxHighlighter } from "@/components/assistant-ui/elements/shiki-highlighter.aui";
const defaultComponents = memoizeMarkdownComponents({
SyntaxHighlighter,
});
The Prism-based syntax-highlighter element remains useful for apps that already depend on react-syntax-highlighter.
npx assistant-ui@latest add syntax-highlighter
import { SyntaxHighlighter } from "@/components/assistant-ui/elements/syntax-highlighter";
Edit the installed markdown-text component's default map, or pass a components override where the element is rendered. See syntax-highlighting.md for the exact renderer contracts.
Render math and diagrams
KaTeX needs remark-math, rehype-katex, and the KaTeX stylesheet. The markdown package exports normalizeMathDelimiters, rewriteCustomMathTags, rewriteLatexBracketDelimiters, and escapeCurrencyDollars for preprocessing model output. The helpers rewrite outside inline code and fenced code, so examples in code stay literal.
Install mermaid-diagram and register its .aui renderer as the mermaid language override. It reads the message part status and shows a skeleton while the stream is running rather than parsing incomplete Mermaid source. See latex-mermaid.md.
Use Streamdown instead
StreamdownTextPrimitive reads the same text-part context and can be wired into
Установить markdown в Claude Code и Claude Desktop
Зарегайся, чтобы установить скилл
Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.
- Открой команду установки в одну строку
- Сохраняй скиллы в синхронизируемую библиотеку
- Уведомления, когда скиллы обновляются
Разрешённые инструменты
Инструменты, которые скиллу разрешено вызывать.
Без ограничений — скилл может использовать любой инструмент.
Вложенные файлы
FAQ
Что делает скилл markdown?
Renders assistant message text as markdown in assistant-ui. Use when wiring MarkdownTextPrimitive or the markdown-text element into MessagePrimitive.Parts, installing Shiki or Prism highlighting, adding KaTeX math or Mermaid diagrams, normalizing model-produced math delimiters, or choosing StreamdownTextPrimitive for block-aware streaming with optional code, math, Mermaid, and CJK plugins. Covers defer and smooth parsing behavior, code block overrides, and stream completion. For the surrounding unstyled message composition use primitives, and for installing or editing a styled renderer use elements.
Как установить скилл markdown?
Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.
Скилл markdown запускает скрипты?
Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.
Похожие скиллы
mcp-builder
Guide for creating high-quality MCP (Model Context Protocol) servers that enable LLMs to interact with external services through well-designed tools. Use when…
от Anthropicclaude-api
Reference for the Claude API / Anthropic SDK — model ids, pricing, params, streaming, tool use, MCP, agents, caching, token counting, model migration. TRIGGER…
от Anthropicalgorithmic-art
Creating algorithmic art using p5.js with seeded randomness and interactive parameter exploration. Use this when users request creating art using code…
от Anthropicmcp-integration
This skill should be used when the user asks to "add MCP server", "integrate MCP", "configure MCP in plugin", "use .mcp.json", "set up Model Context…
от Anthropic