File size: 650 Bytes
9332ccf | 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 28 | /**
* @license
* Copyright 2025 Google LLC
* SPDX-License-Identifier: Apache-2.0
*/
import React from 'react';
import { Text } from 'ink';
import { parseMarkdownToANSI } from './markdownParsingUtils.js';
import { stripUnsafeCharacters } from './textUtils.js';
interface RenderInlineProps {
text: string;
defaultColor?: string;
}
const RenderInlineInternal: React.FC<RenderInlineProps> = ({
text: rawText,
defaultColor,
}) => {
const text = stripUnsafeCharacters(rawText);
const ansiText = parseMarkdownToANSI(text, defaultColor);
return <Text>{ansiText}</Text>;
};
export const RenderInline = React.memo(RenderInlineInternal);
|