nandi/oripublic Fork 0
35061753be581c0ba47a3189520d64e7788c183d
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

InlineText.tsx · 27 lines · 684 BTypeScript Blame HistoryRaw
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
/**
 * InlineText renders a one-line string in which `backtick` spans become
 * monospace <code> elements — for tool call titles, permission titles and
 * plan entries, where full markdown would be overkill but agents routinely
 * quote commands and paths.
 *
 * @example
 * <InlineText text="Run `ls .memory/`" />
 */

export function InlineText({ text }: { text: string }) {
	// Even segments are plain text, odd segments were between backticks.
	const parts = text.split("`");
	return (
		<>
			{parts.map((part, index) =>
				index % 2 === 1 ? (
					<code key={`${index}:${part}`} className="inline-code">
						{part}
					</code>
				) : (
					part
				),
			)}
		</>
	);
}