mirror of
https://github.com/google-gemini/gemini-cli.git
synced 2026-04-07 11:51:14 -07:00
28 lines
650 B
TypeScript
28 lines
650 B
TypeScript
/**
|
|
* @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);
|