/**
* Markdown renders agent text (GitHub-flavoured: tables, task lists, ...).
* Kept as the single markdown entry point so styling and plugins stay
* consistent everywhere agent content appears.
*
* @example
* <Markdown text="**bold** and `code`" />
*/importReactMarkdownfrom"react-markdown";importremarkGfmfrom"remark-gfm";importtype{Components}from"react-markdown";import{CopyButton}from"./CopyButton";exportfunctionMarkdown({text}:{text: string}){constcomponents: Components={pre:({children,...props})=>{// Extract code content from pre > code structure
// react-markdown hands `pre` its rendered <code> child; type its props so
// the string body can be extracted for the copy button.
constcodeElement=childrenasReact.ReactElement<{children?: unknown;}>;constcodeContent=codeElement?.props?.children&&typeofcodeElement.props.children==="string"?codeElement.props.children:"";return(<divclassName="code-block-wrapper">{codeContent&&(<CopyButtoncontent={codeContent}label="Copy code"/>)}<pre{...props}>{children}</pre></div>);},};return(<divclassName="markdown"><ReactMarkdownremarkPlugins={[remarkGfm]}components={components}>{text}</ReactMarkdown></div>);}
One first-party cookie so a repeat visit isn't counted twice. No cross-site tracking, nothing stored until you accept. Cookie Policy.