mirror of
https://github.com/google-gemini/gemini-cli.git
synced 2026-06-15 05:47:18 -07:00
f76aff895a
- This commit refactors the Markdown rendering logic within the CLI UI. The existing `MarkdownRenderer.tsx` class-based component has been replaced with a new functional component `MarkdownDisplay.tsx`. - The `MarkdownDisplay` component is a React.memoized component for improved performance and maintains the same core Markdown parsing and rendering capabilities.
31 lines
710 B
TypeScript
31 lines
710 B
TypeScript
/**
|
|
* @license
|
|
* Copyright 2025 Google LLC
|
|
* SPDX-License-Identifier: Apache-2.0
|
|
*/
|
|
|
|
import React from 'react';
|
|
import { Text, Box } from 'ink';
|
|
import { MarkdownDisplay } from '../../utils/MarkdownDisplay.js';
|
|
import { Colors } from '../../colors.js';
|
|
|
|
interface GeminiMessageProps {
|
|
text: string;
|
|
}
|
|
|
|
export const GeminiMessage: React.FC<GeminiMessageProps> = ({ text }) => {
|
|
const prefix = '✦ ';
|
|
const prefixWidth = prefix.length;
|
|
|
|
return (
|
|
<Box flexDirection="row">
|
|
<Box width={prefixWidth}>
|
|
<Text color={Colors.AccentPurple}>{prefix}</Text>
|
|
</Box>
|
|
<Box flexGrow={1} flexDirection="column">
|
|
<MarkdownDisplay text={text} />
|
|
</Box>
|
|
</Box>
|
|
);
|
|
};
|