Skip to content

Commit 771f5c8

Browse files
PuxhkarPushkar Gupta
andauthored
fix: prevent GFM table tokens from greedily capturing trailing newlines (#3926)
Co-authored-by: Pushkar Gupta <your_email@example.com>
1 parent 4138f72 commit 771f5c8

2 files changed

Lines changed: 2 additions & 1 deletion

File tree

src/Tokenizer.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -525,7 +525,7 @@ export class _Tokenizer<ParserOutput = string, RendererOutput = string> {
525525

526526
const item: Tokens.Table = {
527527
type: 'table',
528-
raw: cap[0],
528+
raw: rtrim(cap[0], '\n'),
529529
header: [],
530530
align: [],
531531
rows: [],

test/unit/marked.test.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1016,6 +1016,7 @@ br
10161016
['text', '2'],
10171017
['text', '3'],
10181018
['text', '4'],
1019+
['space', ''],
10191020
['blockquote', '> blockquote'],
10201021
['paragraph', 'blockquote'],
10211022
['text', 'blockquote'],

0 commit comments

Comments
 (0)