Synthèse automatique
Compétence pour rendre les messages de l'assistant en markdown dans assistant-ui via MarkdownTextPrimitive, avec support de la coloration syntaxique, des mathématiques KaTeX, des diagrammes Mermaid et du streaming, en configurant plugins et composants mémoïsés.
Points forts
- Fournit une configuration complète pour le rendu markdown dans assistant-ui, y compris le code, LaTeX et Mermaid.
- Couvre à la fois MarkdownTextPrimitive et StreamdownTextPrimitive, offrant une alternative clé en main avec streaming par blocs.
- Inclut des pièges courants pratiques pour résoudre les problèmes de rendu, de styles et de streaming partiel.
Limites
- Nécessite des dépendances et configurations supplémentaires pour la coloration syntaxique et les maths ; rien n'est inclus par défaut.
- Certaines API sont marquées comme instables (ex. unstable_memoizeMarkdownComponents) et peuvent évoluer.
- La compétence est spécifique à assistant-ui et React, non applicable à d'autres frameworks.
Utilisez-la lorsque vous construisez une interface de chat assistant en React et que vous devez afficher la sortie du modèle comme markdown formaté avec code, formules ou diagrammes.
Ne l'utilisez pas si vous avez besoin d'un rendu markdown agnostique au framework ou si votre projet n'est pas basé sur assistant-ui.
Analyse de sécurité
SûrThe skill provides documentation and code examples for rendering markdown in assistant-ui. It does not instruct destructive, exfiltrating, or obfuscated actions. No tools are declared, and the content is purely educational/instructional for UI configuration.
Aucun point d'attention détecté
Comment cette analyse est faiteExemples
Wire up MarkdownTextPrimitive in my assistant-ui app so that model responses render as markdown with GitHub-flavored markdown (remark-gfm) and syntax highlighting using react-shiki.Configure my assistant-ui markdown component to render LaTeX math with KaTeX and Mermaid diagrams, but gate the Mermaid rendering on stream completion to avoid partial diagram errors.In my assistant-ui chat, the text parts show as raw plain text instead of formatted markdown. Why? Show me the correct MessagePrimitive.Parts wiring and how to use MarkdownTextPrimitive.name: markdown description: "Render and customize assistant message text as markdown in assistant-ui. Use when displaying model output as formatted markdown with MarkdownTextPrimitive from @assistant-ui/react-markdown wired into the MessagePrimitive.Parts text branch, configuring remarkPlugins (remark-gfm, remark-math) and rehypePlugins (rehype-katex), or memoizing components with unstable_memoizeMarkdownComponents. Covers code-block syntax highlighting via react-shiki or react-syntax-highlighter registered as SyntaxHighlighter in components/componentsByLanguage, LaTeX math rendering with KaTeX, Mermaid diagrams gated on stream completion, custom math delimiters via preprocess, and the StreamdownTextPrimitive alternative from @assistant-ui/react-streamdown with built-in Shiki/KaTeX/Mermaid and block streaming. For general chat UI composition route to primitives." license: MIT
assistant-ui Markdown
Always consult assistant-ui.com/llms.txt for the latest API.
Render and customize assistant message text as markdown with MarkdownTextPrimitive from @assistant-ui/react-markdown, wired into the MessagePrimitive.Parts text branch.
References
- ./references/markdown-text.md -- MarkdownTextPrimitive setup
- ./references/syntax-highlighting.md -- code highlighting (react-shiki / react-syntax-highlighter)
- ./references/latex-mermaid.md -- LaTeX and Mermaid
- ./references/streamdown.md -- StreamdownTextPrimitive alternative
Orientation
MarkdownTextPrimitive renders one text part as markdown. The registry component (npx assistant-ui@latest add markdown-text) generates components/assistant-ui/markdown-text.tsx, which exports a memoized MarkdownText built on the primitive plus a defaultComponents map from unstable_memoizeMarkdownComponents. Render MarkdownText from the text branch of MessagePrimitive.Parts.
import "@assistant-ui/react-markdown/styles/dot.css";
import { MarkdownTextPrimitive } from "@assistant-ui/react-markdown";
import { MessagePrimitive } from "@assistant-ui/react";
import remarkGfm from "remark-gfm";
import { memo } from "react";
const MarkdownTextImpl = () => (
<MarkdownTextPrimitive
remarkPlugins={[remarkGfm]}
className="aui-md"
components={defaultComponents}
/>
);
export const MarkdownText = memo(MarkdownTextImpl);
<MessagePrimitive.Parts>
{({ part }) => (part.type === "text" ? <MarkdownText /> : null)}
</MessagePrimitive.Parts>;
Add highlighting, math, or diagrams by extending the same primitive: rehypePlugins for KaTeX, componentsByLanguage for a per-language SyntaxHighlighter (Mermaid, diff), and preprocess to normalize raw text before parsing. See the references for each. For a batteries-included alternative with built-in Shiki, KaTeX, Mermaid, and block streaming, swap in StreamdownTextPrimitive from @assistant-ui/react-streamdown.
Common Gotchas
- Nothing renders / plain text shows. The
textbranch must returnMarkdownText; returning<p>{part.text}</p>bypasses markdown entirely. - No syntax highlighting. Highlighting is not bundled. Register a
SyntaxHighlighterindefaultComponents(react-shiki recommended) per the syntax-highlighting reference. - KaTeX has no styling. Import
katex/dist/katex.min.cssonce at the app root;rehypeKatexonly emits markup. - Mermaid parses partial diagrams while streaming. Gate rendering on stream completion (the reference uses
useAuiStateto detect the closing fence) instead of rendering every delta. - Memoization export name. The package exports
unstable_memoizeMarkdownComponents; the generated file aliases it tomemoizeMarkdownComponents. - Unstyled by default. The
aui-mdclass andstyles/dot.cssprovide base styling; add your own Tailwind/CSS otherwise.
Related Skills
- primitives -- general UI composition (
ThreadPrimitive,ComposerPrimitive,MessagePrimitive.Parts) for assembling the message and the rest of the chat surface around the markdown text branch.
Du fichier au premier essai
Le téléchargement contient exactement le contenu affiché sur cette fiche. Cette copie peut différer de la dernière version du dépôt source.
Consulter la source et ses fichiers annexesCe téléchargement contient uniquement SKILL.md. Les scripts, références, modèles et dépendances éventuels ne sont pas inclus. Récupérez les fichiers nécessaires depuis la source en conservant leur arborescence avant de poursuivre.
1. Télécharger le fichier
Télécharger SKILL.mdDepuis la racine d’un projet de test, enregistrez le fichier sous .skill-downloads/markdown-rendering-with-assistant-ui-mte1lgth/SKILL.md, ou utilisez la commande suivante. Ce dossier sert à examiner la skill avant son installation.
Commande pour macOS/Linux ou WSL : un shell POSIX et curl sont nécessaires. Sous Windows sans WSL, utilisez le bouton de téléchargement et créez le dossier manuellement.
mkdir -p '.skill-downloads/markdown-rendering-with-assistant-ui-mte1lgth' && curl --fail --show-error --location 'https://skills-guides.com/api/skills/markdown-rendering-with-assistant-ui-mte1lgth/download' --output '.skill-downloads/markdown-rendering-with-assistant-ui-mte1lgth/SKILL.md.part' && mv '.skill-downloads/markdown-rendering-with-assistant-ui-mte1lgth/SKILL.md.part' '.skill-downloads/markdown-rendering-with-assistant-ui-mte1lgth/SKILL.md'2. Vérifier les prérequis
Lisez SKILL.md avant de l’utiliser. Si le fichier cite des scripts ou services externes, examinez-les et préparez les accès nécessaires dans votre environnement de test.
Aucune section de prérequis reconnue dans ce fichier. Cela ne signifie pas qu’il est autonome : les bibliothèques, outils et accès peuvent être cités ailleurs dans le contenu ou dans le dépôt source.
Les plateformes de la fiche sont des indications du catalogue. Les chemins ci-dessous suivent la documentation des outils ; ils ne prouvent pas que cette skill y a été exécutée. Aucune version minimale de ces outils n’est attestée pour cette fiche.
3. Charger la skill
Après vérification, copiez le dossier complet dans le projet avec l’une des commandes ci-dessous, puis ouvrez une nouvelle session de l’outil. La commande s’arrête si un dossier du même nom existe déjà : comparez les fichiers avant de le remplacer.
Claude Code
test -f '.skill-downloads/markdown-rendering-with-assistant-ui-mte1lgth/SKILL.md' && test -s '.skill-downloads/markdown-rendering-with-assistant-ui-mte1lgth/SKILL.md' && mkdir -p '.claude/skills' && test ! -e '.claude/skills/markdown' && cp -R '.skill-downloads/markdown-rendering-with-assistant-ui-mte1lgth' '.claude/skills/markdown'Cursor
test -f '.skill-downloads/markdown-rendering-with-assistant-ui-mte1lgth/SKILL.md' && test -s '.skill-downloads/markdown-rendering-with-assistant-ui-mte1lgth/SKILL.md' && mkdir -p '.cursor/skills' && test ! -e '.cursor/skills/markdown' && cp -R '.skill-downloads/markdown-rendering-with-assistant-ui-mte1lgth' '.cursor/skills/markdown'Codex
test -f '.skill-downloads/markdown-rendering-with-assistant-ui-mte1lgth/SKILL.md' && test -s '.skill-downloads/markdown-rendering-with-assistant-ui-mte1lgth/SKILL.md' && mkdir -p '.agents/skills' && test ! -e '.agents/skills/markdown' && cp -R '.skill-downloads/markdown-rendering-with-assistant-ui-mte1lgth' '.agents/skills/markdown'OpenSkills
OpenSkills doit déjà être installé. La procédure locale install/read est contrôlée avec OpenSkills 1.5.0, qui exige Node.js ≥ 20.6.0. Aucun slug du catalogue n’est résolu automatiquement.
Installation officielle d’OpenSkillsopenskills install './.skill-downloads/markdown-rendering-with-assistant-ui-mte1lgth'openskills read 'markdown-rendering-with-assistant-ui-mte1lgth'La lecture doit afficher le contenu du fichier installé et son dossier de base. Elle ne lance ni la skill ni ses dépendances.
Pour un agent qui lit AGENTS.md, synchronisez ensuite l’index. Cette commande modifie AGENTS.md : relisez le diff avant de l’utiliser.
openskills syncMode manuel ou autre outil : joignez SKILL.md à une conversation, ou ouvrez-le dans un agent capable de lire les fichiers. Ajoutez les ressources annexes nécessaires. Il n’existe pas de dossier universel reconnu par tous les outils.
4. Faire un premier essai
Utilisez une entrée courte et fictive : un endpoint d’API, un petit document ou un brief d’interface. Dans une nouvelle conversation, joignez le fichier ou donnez son chemin à l’agent, puis adaptez cette demande :
Lis .skill-downloads/markdown-rendering-with-assistant-ui-mte1lgth/SKILL.md et applique ses instructions à cet exemple : [décrire une entrée de test]. Indique les fichiers, dépendances ou accès qui manquent. Produis le résultat demandé par la skill sans inventer de données ni exécuter de script non examiné.Résultat attendu : une sortie correspondant aux instructions de la skill, ou une liste précise des prérequis manquants. Une simple confirmation de lecture ne valide pas le premier usage. Si une ressource externe est indisponible, ce parcours reste à tester.
Bonnes pratiques React Hook Form
Developpement
Maîtrisez React Hook Form : évitez les anti-patterns, gérez les abonnements, et traitez correctement reset, dirty state et entrées contrôlées.
Migration Emotion vers Mantine
Developpement
Migrer les styled-components Emotion vers des composants Mantine avec style props et modules CSS. Pour convertir .styled.tsx ou supprimer les imports @emotion.
Détecteur de dérive de périmètre
Developpement
Analyse les diffs git par rapport à une intention pour détecter la dérive de périmètre, fichiers non liés et PR trop larges, puis suggère de garder, diviser ou justifier.