fix: prevent GFM table tokens from greedily capturing trailing newlines#3926
fix: prevent GFM table tokens from greedily capturing trailing newlines#3926Puxhkar wants to merge 2 commits intomarkedjs:masterfrom
Conversation
|
@servis is attempting to deploy a commit to the MarkedJS Team on Vercel. A member of the Team first needs to authorize it. |
Summary of ChangesHello, 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 refines the tokenization process by ensuring that block-level elements, particularly GFM tables, do not include extraneous trailing newlines in their Highlights
Using Gemini Code AssistThe 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
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 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. Footnotes
|
There was a problem hiding this comment.
Code Review
The code changes refine the tokenization process by removing trailing newline characters from the raw property of block-level tokens, specifically headings, definitions, and tables, in src/Tokenizer.ts using rtrim. Corresponding unit tests in test/unit/Lexer.test.js and test/unit/marked.test.js have been updated to reflect this change, now explicitly including space tokens to represent the newlines that were previously implicitly part of the block tokens' raw content. This improves the precision of token representation by separating structural content from whitespace.
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Summary
Following the fix for headings (#3513), I discovered that GFM table tokens also greedily capture multiple trailing newlines in their
rawproperty. This PR brings the table tokenizer into consistency with other block-level elements.Changes
rawfield in the table() method.Verification
hrandparagraph.Fixes #3513 (Consistency follow-up)