Skip to content

Commit

Permalink
Merge pull request #1439 from UziTech/new-line-after-table
Browse files Browse the repository at this point in the history
New line after table
  • Loading branch information
UziTech committed Mar 12, 2019
2 parents a685251 + 11d8f65 commit f8679c9
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 1 deletion.
2 changes: 1 addition & 1 deletion lib/marked.js
Original file line number Diff line number Diff line change
Expand Up @@ -452,7 +452,7 @@ Lexer.prototype.token = function(src, top) {
type: 'table',
header: splitCells(cap[1].replace(/^ *| *\| *$/g, '')),
align: cap[2].replace(/^ *|\| *$/g, '').split(/ *\| */),
cells: cap[3] ? cap[3].replace(/(?: *\| *)?\n$/, '').split('\n') : []
cells: cap[3] ? cap[3].replace(/\n$/, '').split('\n') : []
};

if (item.header.length === item.align.length) {
Expand Down
24 changes: 24 additions & 0 deletions test/specs/marked/marked.json
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,30 @@
"html": "<p><em>test</em>. <em>test</em>: <em>test</em>! <em>test</em>? <em>test</em>-</p>",
"example": 15
},
{
"section": "Table cells",
"markdown": "1|2\n-|-\n1\\|\\\\|2\\|\\\\",
"html": "<table><thead><tr><th>1</th><th>2</th></tr></thead><tbody><tr><td>1|\\</td><td>2|\\</td></tr></tbody></table>",
"example": 19
},
{
"section": "Table cells",
"markdown": "1|2\n-|-\n |2",
"html": "<table><thead><tr><th>1</th><th>2</th></tr></thead><tbody><tr><td></td><td>2</td></tr></tbody></table>",
"example": 20
},
{
"section": "Table cells",
"markdown": "1|2\n-|-\n1|2\\|\n\n1|2\n-|-\n1|2\\|",
"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>",
"example": 21
},
{
"section": "Table cells",
"markdown": "|1|2|\n|-|-|\n|1|2\\||\n\n|1|2|\n|-|-|\n|1|2\\||",
"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>",
"example": 22
},
{
"section": "Links",
"markdown": "[One](https://example.com/1) ([Two](https://example.com/2)) [Three](https://example.com/3)",
Expand Down

0 comments on commit f8679c9

Please sign in to comment.