diff --git a/lib/lex/block.js b/lib/lex/block.js index 96fc6f6..60cc47d 100644 --- a/lib/lex/block.js +++ b/lib/lex/block.js @@ -319,7 +319,7 @@ Lexer.prototype.token = function(src, top, bq) { type: 'table', header: cap[1].replace(/^ *| *\| *$/g, '').split(/ *\| */), align: cap[2].replace(/^ *|\| *$/g, '').split(/ *\| */), - cells: cap[3].replace(/(?: *\| *)?\n$/, '').split('\n').slice(0), + cells: cap[3].replace(/( *\| *)?\n$/, '$1').split('\n').slice(0), }; for (i = 0; i < item.align.length; i++) { diff --git a/test/tests/gfm_tables.html b/test/tests/gfm_tables.html index 70bec82..6497f2a 100644 --- a/test/tests/gfm_tables.html +++ b/test/tests/gfm_tables.html @@ -35,3 +35,12 @@ Cell 5Cell 6Cell 7Cell 8 + + + + + + + + +
Heading 1Heading 2
Cell 1
Cell 3
\ No newline at end of file diff --git a/test/tests/gfm_tables.text b/test/tests/gfm_tables.text index 5fd6321..44166c4 100644 --- a/test/tests/gfm_tables.text +++ b/test/tests/gfm_tables.text @@ -19,3 +19,8 @@ Header 1|Header 2|Header 3|Header 4 :-------|:------:|-------:|-------- Cell 1 |Cell 2 |Cell 3 |Cell 4 *Cell 5*|Cell 6 |Cell 7 |Cell 8 + +| Heading 1 | Heading 2 | +| --------- | --------- | +| Cell 1 | | +| Cell 3 | |