-
Notifications
You must be signed in to change notification settings - Fork 9.3k
feat: Add markdown toggle (alt+m) to switch between rendered and raw… #10383
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
|
Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA). View this failed invocation of the CLA check for more information. For the most up to date status, view the checks section at the bottom of the pull request. |
jacob314
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is really helpful. Added some comments. Approved after those are addressed and there is a snapshot test fo the raw markdown display cases in GeminiMessage and ToolMessage.
packages/cli/src/ui/components/messages/ToolMessageRawMarkdown.test.tsx
Outdated
Show resolved
Hide resolved
… display Implements feature request from google-gemini#6499 to toggle between rendered and raw markdown mode. - Add Ctrl+B keybinding to toggle markdown rendering globally - Add renderMarkdown setting to UI config (default: true) - Update MarkdownDisplay to support raw mode with syntax highlighting - Update GeminiMessage, GeminiMessageContent, and ToolMessage to respect toggle - Add UIStateContext to test utilities for component testing - Visual indicator in footer (currently commented out) Fixes google-gemini#6499
- Modified MarkdownDisplay to pass showLineNumbers: false when renderMarkdown is false - Line numbers were confusing in raw mode due to chunked Gemini output - Added snapshot tests for GeminiMessage and ToolMessage raw markdown rendering - Tests verify line numbers are hidden in raw mode but shown in rendered mode
- ✅ keyBindings.ts - Updated to Alt+Shift+M (command+shift+m) - ✅ keyMatchers.test.ts - Updated tests for Alt+Shift+M - ✅ MarkdownDisplay.tsx - Fixed line numbers in raw mode - ✅ Snapshot files - Updated and cleaned (4 obsolete snapshots removed)
…er access Added dual Alt/Option key support for cross-terminal compatibility: - Unicode mapping for terminals that send Unicode chars (iTerm2, VSCode) - ESC sequence handling for terminals that send escape sequences - Improved letter key handling to support both uppercase and lowercase with modifiers - Updated tests to reflect new Cmd+M keybinding
… (lines 414-422) 2. ✅ Updated AppContainer.tsx to always initialize renderMarkdown to true instead of reading from settings
0cf58a9 to
3484e69
Compare
Display "raw markdown mode (cmd+m to toggle)" indicator above input prompt when markdown rendering is disabled, consistent with shell mode and YOLO mode indicators. - Add RawMarkdownIndicator component - Show indicator in Composer when renderMarkdown is false - Add tests for RawMarkdownIndicator visibility - Remove commented markdown toggle code from Footer
|
Please update the pr description to mention alt-m rather than ctrl-B. to avoid confusion if someone is looking through the changelog. |
| ShellModeIndicator: () => <Text>ShellModeIndicator</Text>, | ||
| })); | ||
|
|
||
| vi.mock('./RawMarkdownIndicator.js', () => ({ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Gemini CLI likes to mock too much. This isn't something that should be mocked.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
| <Box> | ||
| <Text> | ||
| raw markdown mode | ||
| <Text color={theme.text.secondary}> (alt+m to toggle) </Text> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
make this platform aware. Mac users have no idea what "alt" is. Call it "option+m" for them.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
jacob314
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is looking great! Approved after these comments are addressed.
Show "option+m" on macOS and "alt+m" on other platforms for the markdown toggle shortcut, and remove mock from RawMarkdownIndicator tests to verify actual component behavior.
jacob314
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
…etween rendered and raw… (google-gemini#10383)
…google-gemini#10383) Co-authored-by: Jacob Richman <jacob314@gmail.com>
… display
Implements feature request from #6499 to toggle between rendered and raw markdown mode.
Fixes #6499
TLDR
Dive Deeper
Reviewer Test Plan
Testing Matrix
Linked issues / bugs