Skip to content

Commit f8679c9

Browse files
authored
Merge pull request #1439 from UziTech/new-line-after-table
New line after table
2 parents a685251 + 11d8f65 commit f8679c9

File tree

2 files changed

+25
-1
lines changed

2 files changed

+25
-1
lines changed

lib/marked.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -452,7 +452,7 @@ Lexer.prototype.token = function(src, top) {
452452
type: 'table',
453453
header: splitCells(cap[1].replace(/^ *| *\| *$/g, '')),
454454
align: cap[2].replace(/^ *|\| *$/g, '').split(/ *\| */),
455-
cells: cap[3] ? cap[3].replace(/(?: *\| *)?\n$/, '').split('\n') : []
455+
cells: cap[3] ? cap[3].replace(/\n$/, '').split('\n') : []
456456
};
457457

458458
if (item.header.length === item.align.length) {

test/specs/marked/marked.json

+24
Original file line numberDiff line numberDiff line change
@@ -119,6 +119,30 @@
119119
"html": "<p><em>test</em>. <em>test</em>: <em>test</em>! <em>test</em>? <em>test</em>-</p>",
120120
"example": 15
121121
},
122+
{
123+
"section": "Table cells",
124+
"markdown": "1|2\n-|-\n1\\|\\\\|2\\|\\\\",
125+
"html": "<table><thead><tr><th>1</th><th>2</th></tr></thead><tbody><tr><td>1|\\</td><td>2|\\</td></tr></tbody></table>",
126+
"example": 19
127+
},
128+
{
129+
"section": "Table cells",
130+
"markdown": "1|2\n-|-\n |2",
131+
"html": "<table><thead><tr><th>1</th><th>2</th></tr></thead><tbody><tr><td></td><td>2</td></tr></tbody></table>",
132+
"example": 20
133+
},
134+
{
135+
"section": "Table cells",
136+
"markdown": "1|2\n-|-\n1|2\\|\n\n1|2\n-|-\n1|2\\|",
137+
"html": "<table><thead><tr><th>1</th><th>2</th></tr></thead><tbody><tr><td>1</td><td>2|</td></tr></tbody></table>\n\n<table><thead><tr><th>1</th><th>2</th></tr></thead><tbody><tr><td>1</td><td>2|</td></tr></tbody></table>",
138+
"example": 21
139+
},
140+
{
141+
"section": "Table cells",
142+
"markdown": "|1|2|\n|-|-|\n|1|2\\||\n\n|1|2|\n|-|-|\n|1|2\\||",
143+
"html": "<table><thead><tr><th>1</th><th>2</th></tr></thead><tbody><tr><td>1</td><td>2|</td></tr></tbody></table>\n\n<table><thead><tr><th>1</th><th>2</th></tr></thead><tbody><tr><td>1</td><td>2|</td></tr></tbody></table>",
144+
"example": 22
145+
},
122146
{
123147
"section": "Links",
124148
"markdown": "[One](https://example.com/1) ([Two](https://example.com/2)) [Three](https://example.com/3)",

0 commit comments

Comments
 (0)