From 9c26b615d7542f7ddd0767056da3e8808cf3acaf Mon Sep 17 00:00:00 2001 From: Tony Brix Date: Thu, 7 Mar 2019 16:21:14 -0600 Subject: [PATCH 1/2] add tests --- test/specs/marked/marked.json | 26 +++++++++++++++++++++++++- 1 file changed, 25 insertions(+), 1 deletion(-) diff --git a/test/specs/marked/marked.json b/test/specs/marked/marked.json index 5f46f53640..257def99fb 100644 --- a/test/specs/marked/marked.json +++ b/test/specs/marked/marked.json @@ -113,10 +113,34 @@ "html": "

test@test.com

", "example": 1347 }, - { + { "section": "Emphasis extra tests", "markdown": "_test_. _test_: _test_! _test_? _test_-", "html": "

test. test: test! test? test-

", "example": 15 + }, + { + "section": "Table cells", + "markdown": "1|2\n-|-\n1\\|\\\\|2\\|\\\\", + "html": "
12
1|\\2|\\
", + "example": 19 + }, + { + "section": "Table cells", + "markdown": "1|2\n-|-\n |2", + "html": "
12
2
", + "example": 20 + }, + { + "section": "Table cells", + "markdown": "1|2\n-|-\n1|2\\|\n\n1|2\n-|-\n1|2\\|", + "html": "
12
12|
\n\n
12
12|
", + "example": 21 + }, + { + "section": "Table cells", + "markdown": "|1|2|\n|-|-|\n|1|2\\||\n\n|1|2|\n|-|-|\n|1|2\\||", + "html": "
12
12|
\n\n
12
12|
", + "example": 22 } ] From 27fdafbd919a5707597dfb87e962f039426a048b Mon Sep 17 00:00:00 2001 From: Tony Brix Date: Thu, 7 Mar 2019 16:21:33 -0600 Subject: [PATCH 2/2] fix new line after table --- lib/marked.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/marked.js b/lib/marked.js index f34e2df0bc..30e4ed4322 100644 --- a/lib/marked.js +++ b/lib/marked.js @@ -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) {