g1t/apps/web/app/components/inline-markdown.tsx
| 1 | import { inlineParts } from "../lib/inline-markdown"; |
| 2 | |
| 3 | /** One line of an agent's or a memory's text, with its bold, italics and code shown as such. */ |
| 4 | export function InlineMarkdown({ text }: { text: string }) { |
| 5 | return ( |
| 6 | <> |
| 7 | {inlineParts(text).map((part, index) => |
| 8 | part.kind === "strong" ? ( |
| 9 | <strong key={index} className="font-semibold text-fg"> |
| 10 | {part.text} |
| 11 | </strong> |
| 12 | ) : part.kind === "em" ? ( |
| 13 | <em key={index}>{part.text}</em> |
| 14 | ) : part.kind === "code" ? ( |
| 15 | <code key={index} className="rounded bg-raised px-1 font-mono text-[0.9em]"> |
| 16 | {part.text} |
| 17 | </code> |
| 18 | ) : ( |
| 19 | part.text |
| 20 | ), |
| 21 | )} |
| 22 | </> |
| 23 | ); |
| 24 | } |