Skip to content

Moved markdown parsing logic to a separate util file#20526

Merged
devr0306 merged 2 commits intomainfrom
unify-markdown-parser
Feb 27, 2026
Merged

Moved markdown parsing logic to a separate util file#20526
devr0306 merged 2 commits intomainfrom
unify-markdown-parser

Conversation

@devr0306
Copy link
Contributor

Summary

Moved markdown parsing logic into a separate utility file.

Details

This is to maintain code cleanliness and keep the utilities separate from the rendering logic.

Related Issues

Closes #20061

How to Validate

Run npm test -w @google/gemini-cli -- src/ui/utils/markdownParsingUtils.test.ts. The tests should all pass.

Pre-Merge Checklist

  • Updated relevant documentation and README (if needed)
  • Added/updated tests (if needed)
  • Noted breaking changes (if any)
  • Validated on required platforms/methods:
    • MacOS
      • npm run
      • npx
      • Docker
      • Podman
      • Seatbelt
    • Windows
      • npm run
      • npx
      • Docker
    • Linux
      • npm run
      • npx
      • Docker

@devr0306 devr0306 requested a review from a team as a code owner February 27, 2026 02:25
@gemini-code-assist
Copy link
Contributor

Summary of Changes

Hello, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request improves code cleanliness and maintainability by centralizing the markdown parsing logic into a new, separate utility file. This refactoring ensures that rendering components are decoupled from the parsing implementation, making the codebase easier to understand, test, and extend.

Highlights

  • Code Organization: The core markdown parsing logic, previously embedded within InlineMarkdownRenderer.tsx, has been extracted into a dedicated utility file, markdownParsingUtils.ts.
  • Refactoring: The InlineMarkdownRenderer.tsx file was refactored to import and utilize the parseMarkdownToANSI function from the new utility file, significantly reducing its size and improving modularity.
  • Dependency Updates: Other components, such as TableRenderer.tsx and markdownParsingUtils.test.ts, have been updated to import the markdown parsing function from its new location.
Changelog
  • packages/cli/src/ui/utils/InlineMarkdownRenderer.tsx
    • Removed markdown parsing functions and related imports.
    • Updated to import parseMarkdownToANSI from markdownParsingUtils.js.
  • packages/cli/src/ui/utils/TableRenderer.tsx
    • Updated import path for parseMarkdownToANSI.
  • packages/cli/src/ui/utils/markdownParsingUtils.test.ts
    • Updated import path for parseMarkdownToANSI.
  • packages/cli/src/ui/utils/markdownParsingUtils.ts
    • Added new file containing the ansiColorize and parseMarkdownToANSI functions, along with their dependencies.
Activity
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request successfully refactors the markdown parsing logic into a dedicated utility file, markdownParsingUtils.ts. This change significantly improves code cleanliness and separation of concerns, making the InlineMarkdownRenderer.tsx and TableRenderer.tsx components more focused on rendering rather than parsing. The move of the parseMarkdownToANSI function and its associated helpers and constants to a new file enhances maintainability and reusability of the markdown parsing logic. The updated import paths in the affected files and the test file correctly reflect this change. The new file includes the required license header, adhering to the repository's conventions.

@github-actions
Copy link

github-actions bot commented Feb 27, 2026

Size Change: +52 B (0%)

Total Size: 25.7 MB

ℹ️ View Unchanged
Filename Size Change
./bundle/gemini.js 25.2 MB +52 B (0%)
./bundle/node_modules/@google/gemini-cli-devtools/dist/client/main.js 221 kB 0 B
./bundle/node_modules/@google/gemini-cli-devtools/dist/src/_client-assets.js 227 kB 0 B
./bundle/node_modules/@google/gemini-cli-devtools/dist/src/index.js 11.5 kB 0 B
./bundle/node_modules/@google/gemini-cli-devtools/dist/src/types.js 132 B 0 B
./bundle/sandbox-macos-permissive-open.sb 890 B 0 B
./bundle/sandbox-macos-permissive-proxied.sb 1.31 kB 0 B
./bundle/sandbox-macos-restrictive-open.sb 3.36 kB 0 B
./bundle/sandbox-macos-restrictive-proxied.sb 3.56 kB 0 B
./bundle/sandbox-macos-strict-open.sb 4.82 kB 0 B
./bundle/sandbox-macos-strict-proxied.sb 5.02 kB 0 B

compressed-size-action

@gemini-cli gemini-cli bot added the 🔒 maintainer only ⛔ Do not contribute. Internal roadmap item. label Feb 27, 2026
Copy link
Contributor

@jacob314 jacob314 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

@devr0306 devr0306 added this pull request to the merge queue Feb 27, 2026
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks Feb 27, 2026
@devr0306 devr0306 enabled auto-merge February 27, 2026 16:54
@devr0306 devr0306 added this pull request to the merge queue Feb 27, 2026
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks Feb 27, 2026
@devr0306 devr0306 added this pull request to the merge queue Feb 27, 2026
Merged via the queue into main with commit ec39aa1 Feb 27, 2026
27 checks passed
@devr0306 devr0306 deleted the unify-markdown-parser branch February 27, 2026 17:55
BryanBradfo pushed a commit to BryanBradfo/gemini-cli that referenced this pull request Mar 5, 2026
liamhelmer pushed a commit to badal-io/gemini-cli that referenced this pull request Mar 12, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

🔒 maintainer only ⛔ Do not contribute. Internal roadmap item.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Create a unified parser for tables and regular markdown

2 participants