diff --git a/src/Tokenizer.js b/src/Tokenizer.js
index 61ed269a09..8ef871d606 100644
--- a/src/Tokenizer.js
+++ b/src/Tokenizer.js
@@ -355,7 +355,7 @@ export class Tokenizer {
type: 'table',
header: splitCells(cap[1]).map(c => { return { text: c }; }),
align: cap[2].replace(/^ *|\| *$/g, '').split(/ *\| */),
- rows: cap[3] ? cap[3].replace(/\n$/, '').split('\n') : []
+ rows: cap[3] ? cap[3].replace(/\n[ \t]*$/, '').split('\n') : []
};
if (item.header.length === item.align.length) {
diff --git a/test/specs/new/tab_newline.html b/test/specs/new/tab_newline.html
new file mode 100644
index 0000000000..77e5010172
--- /dev/null
+++ b/test/specs/new/tab_newline.html
@@ -0,0 +1,38 @@
+
+
+
+ y |
+
+
+
+
+ x |
+
+
+
+
+
+
+ y |
+
+
+
+
+ x |
+
+
+
+
+
+
+ y |
+
+
+
+
+ x |
+
+
+
+code
+
diff --git a/test/specs/new/tab_newline.md b/test/specs/new/tab_newline.md
new file mode 100644
index 0000000000..5058d77d54
--- /dev/null
+++ b/test/specs/new/tab_newline.md
@@ -0,0 +1,12 @@
+| y |
+| - |
+| x |
+
+| y |
+| - |
+| x |
+
+| y |
+| - |
+| x |
+ code
\ No newline at end of file