Skip to content

Commit

Permalink
fix: fix blank line after table header (#2332)
Browse files Browse the repository at this point in the history
  • Loading branch information
UziTech committed Jan 26, 2022
1 parent 5384d17 commit 6e1f923
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/Tokenizer.js
Expand Up @@ -369,7 +369,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[ \t]*$/, '').split('\n') : []
rows: cap[3] && cap[3].trim() ? cap[3].replace(/\n[ \t]*$/, '').split('\n') : []
};

if (item.header.length === item.align.length) {
Expand Down
7 changes: 7 additions & 0 deletions test/specs/new/tab_newline.html
Expand Up @@ -36,3 +36,10 @@
</table>
<pre><code>code
</code></pre>
<table>
<thead>
<tr>
<th>y</th>
</tr>
</thead>
</table>
5 changes: 4 additions & 1 deletion test/specs/new/tab_newline.md
Expand Up @@ -9,4 +9,7 @@
| y |
| - |
| x |
code
code
| y |
| - |

1 comment on commit 6e1f923

@vercel
Copy link

@vercel vercel bot commented on 6e1f923 Jan 26, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.