Skip to content

Commit

Permalink
fix: stop table at lines with only whitespace (#2188)
Browse files Browse the repository at this point in the history
  • Loading branch information
UziTech authored Aug 25, 2021
1 parent e583f46 commit 21268ab
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/rules.js
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ block.normal = merge({}, block);
block.gfm = merge({}, block.normal, {
table: '^ *([^\\n ].*\\|.*)\\n' // Header
+ ' {0,3}(?:\\| *)?(:?-+:? *(?:\\| *:?-+:? *)*)\\|?' // Align
+ '(?:\\n *((?:(?!\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)' // Cells
+ '(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)' // Cells
});

block.gfm.table = edit(block.gfm.table)
Expand Down
16 changes: 16 additions & 0 deletions test/specs/new/space_after_table.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
<table>
<thead>
<tr>
<th>a</th>
<th>b</th>
</tr>
</thead>
<tbody>
<tr>
<td>1</td>
<td>2</td>
</tr>
</tbody>
</table>

<p>there should be a single space in the line above</p>
8 changes: 8 additions & 0 deletions test/specs/new/space_after_table.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
---
gfm: true
---
| a | b |
|---|---|
| 1 | 2 |

there should be a single space in the line above

1 comment on commit 21268ab

@vercel
Copy link

@vercel vercel bot commented on 21268ab Aug 25, 2021

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.