-
Notifications
You must be signed in to change notification settings - Fork 2.8k
added table rendering #5620
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
added table rendering #5620
Conversation
|
Thanks for the PR. While reviewing the implementation, I noticed this adds quite a bit of complexity with a custom markdown parser for tables separate from the existing MarkdownBlock component. Have you considered whether using remark-gfm (which includes table support) within the existing markdown pipeline might be simpler? The current implementation certainly works, but I'm wondering if there's a way to reduce the overall complexity and maintenance burden by leveraging the existing markdown processing infrastructure. |
|
@daniel-lxs Thanks for your reply. |
|
Hey @PaperBoardOfficial I came up with this #6252, Let me know what you think! |
@daniel-lxs I’m impressed by your vibe, type beat. Way more minimal than mine, fr. You the OG when it comes to coding and already proved you can straight up cook. |
|
I'm glad you like it, I really appreciate the time you put into this. Thank you! |
Related GitHub Issue
Closes: #4787
Roo Code Task Context (Optional)
Description
I tried different ways. One was the most trivial one: use
remark-gfmbut it didn't render the tables properly. So, I wrote a custom table parser file. I took inspiration from one of my previous work, though I altered it according to our usecase.First, I tried plugging the code in MarkdownBlock.tsx but I found out that it only rendered tables when they came wrapped in backticks (```). But this was not good because most of the time llms would return table that are not encapsulated in backticks.
So, I plugged the code in Markdown.tsx file. But the problem came that sometimes the table data came mix with normal text. For example:
Hence I wrote a function called
splitMarkdownAndTablesto split the normal text from table.I have also added 2 test files and 26 unit tests.
If you want to test it, you can prompt
Give me difference between proxy and vpn in a table. The code will properly handle tables if they are wrapped in backticks (```) or not. The code will also handle tables which has urls. The code will also handle bold text or strikethrough text.Test Procedure
Pre-Submission Checklist
Screenshots / Videos
Documentation Updates
Additional Notes
Get in Touch
Important
Adds custom table rendering in markdown with
splitMarkdownAndTablesandTableParser, including extensive tests.Markdown.tsxusingsplitMarkdownAndTablesto separate text and tables.parseTableinTableParser.tsxto parse and render markdown tables.parseInlineMarkdowninInlineParser.tsx.MarkdownTableIntegration.spec.tsxwith 13 tests for markdown table integration.TableParser.spec.tsxwith 14 tests for table parsing and inline markdown.MarkdownBlockanduseExtensionStatein tests for consistent environment.This description was created by
for b990949. You can customize this summary. It will automatically update as commits are pushed.