nandi/oripublic Fork 0
55d4c9e2f7a9027b52846558166f42e50851523a
Commits
Clone
git clone https://git.rickub.com/nandi/ori.git
git clone ssh://git@rickub.com/nandi/ori.git

Host key fingerprint (ed25519): SHA256:iycHnxEyq0Q7uyVpB7JlznP0G7JrTPXLYRcAU5CSLhc — verify it before your first connect.

forked from bots-garden/ori

Markdown.tsx · 48 lines · 1.3 KBTypeScript Blame HistoryRaw
✨ Introduce new feature(s): ACP web client — Go backend (agent, bridge, httpserver, mockagent) + React SPA (Zed-like agent panel), tests, quality gate PASS 2434cc7 k33g yesterday1/**
2 * Markdown renders agent text (GitHub-flavoured: tables, task lists, ...).
3 * Kept as the single markdown entry point so styling and plugins stay
4 * consistent everywhere agent content appears.
5 *
6 * @example
7 * <Markdown text="**bold** and `code`" />
8 */
9
10import ReactMarkdown from "react-markdown";
11import remarkGfm from "remark-gfm";
Add copy-paste functionality for code blocks and completion widgets 7895c1d k33g yesterday12import type { Components } from "react-markdown";
13import { CopyButton } from "./CopyButton";
✨ Introduce new feature(s): ACP web client — Go backend (agent, bridge, httpserver, mockagent) + React SPA (Zed-like agent panel), tests, quality gate PASS 2434cc7 k33g yesterday14
15export function Markdown({ text }: { text: string }) {
Add copy-paste functionality for code blocks and completion widgets 7895c1d k33g yesterday16 const components: Components = {
17 pre: ({ children, ...props }) => {
18 // Extract code content from pre > code structure
✨ Switch the ACP adapter to @agentclientprotocol/claude-agent-acp (template 0.0.2) 5d476ff k33g yesterday19 // react-markdown hands `pre` its rendered <code> child; type its props so
20 // the string body can be extracted for the copy button.
21 const codeElement = children as React.ReactElement<{
22 children?: unknown;
23 }>;
Add copy-paste functionality for code blocks and completion widgets 7895c1d k33g yesterday24 const codeContent =
25 codeElement?.props?.children &&
26 typeof codeElement.props.children === "string"
27 ? codeElement.props.children
28 : "";
29
30 return (
31 <div className="code-block-wrapper">
✨ Switch the ACP adapter to @agentclientprotocol/claude-agent-acp (template 0.0.2) 5d476ff k33g yesterday32 {codeContent && (
33 <CopyButton content={codeContent} label="Copy code" />
34 )}
Add copy-paste functionality for code blocks and completion widgets 7895c1d k33g yesterday35 <pre {...props}>{children}</pre>
36 </div>
37 );
38 },
39 };
40
✨ Introduce new feature(s): ACP web client — Go backend (agent, bridge, httpserver, mockagent) + React SPA (Zed-like agent panel), tests, quality gate PASS 2434cc7 k33g yesterday41 return (
42 <div className="markdown">
Add copy-paste functionality for code blocks and completion widgets 7895c1d k33g yesterday43 <ReactMarkdown remarkPlugins={[remarkGfm]} components={components}>
44 {text}
45 </ReactMarkdown>
✨ Introduce new feature(s): ACP web client — Go backend (agent, bridge, httpserver, mockagent) + React SPA (Zed-like agent panel), tests, quality gate PASS 2434cc7 k33g yesterday46 </div>
47 );
48}