-
Notifications
You must be signed in to change notification settings - Fork 3.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix GFM tables not breaking on block-level structures #1598
Merged
Merged
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
090d11e
Fix GFM tables not breaking on block-level structures
calculuschild a794959
Removed console.log
calculuschild 30ca83b
Update src/rules.js
calculuschild ec38dd1
Remove + on heading regex
calculuschild 5972e73
Update fences after tables regex
calculuschild File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
<table> | ||
<thead> | ||
<tr> | ||
<th>abc</th> | ||
<th>def</th> | ||
</tr> | ||
</thead> | ||
<tbody> | ||
<tr> | ||
<td>bar</td> | ||
<td>foo</td> | ||
</tr> | ||
<tr> | ||
<td>baz</td> | ||
<td>boo</td> | ||
</tr> | ||
</tbody> | ||
</table> | ||
<pre><code>a simple | ||
*indented* code block | ||
</code></pre> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
| abc | def | | ||
| --- | --- | | ||
| bar | foo | | ||
| baz | boo | | ||
a simple | ||
*indented* code block |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
<table> | ||
<thead> | ||
<tr> | ||
<th>abc</th> | ||
<th>def</th> | ||
</tr> | ||
</thead> | ||
<tbody> | ||
<tr> | ||
<td>bar</td> | ||
<td>foo</td> | ||
</tr> | ||
<tr> | ||
<td>baz</td> | ||
<td>boo</td> | ||
</tr> | ||
</tbody> | ||
</table> | ||
<pre><code>foobar()</code></pre> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
| abc | def | | ||
| --- | --- | | ||
| bar | foo | | ||
| baz | boo | | ||
``` | ||
foobar() | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
<table> | ||
<thead> | ||
<tr> | ||
<th>abc</th> | ||
<th>def</th> | ||
</tr> | ||
</thead> | ||
<tbody> | ||
<tr> | ||
<td>bar</td> | ||
<td>foo</td> | ||
</tr> | ||
<tr> | ||
<td>baz</td> | ||
<td>boo</td> | ||
</tr> | ||
</tbody> | ||
</table> | ||
<h1 id="title">title</h1> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
| abc | def | | ||
| --- | --- | | ||
| bar | foo | | ||
| baz | boo | | ||
# title |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
<table> | ||
<thead> | ||
<tr> | ||
<th>abc</th> | ||
<th>def</th> | ||
</tr> | ||
</thead> | ||
<tbody> | ||
<tr> | ||
<td>bar</td> | ||
<td>foo</td> | ||
</tr> | ||
<tr> | ||
<td>baz</td> | ||
<td>boo</td> | ||
</tr> | ||
</tbody> | ||
</table> | ||
<hr> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
| abc | def | | ||
| --- | --- | | ||
| bar | foo | | ||
| baz | boo | | ||
___ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
<table> | ||
<thead> | ||
<tr> | ||
<th>abc</th> | ||
<th>def</th> | ||
</tr> | ||
</thead> | ||
<tbody> | ||
<tr> | ||
<td>bar</td> | ||
<td>foo</td> | ||
</tr> | ||
<tr> | ||
<td>baz</td> | ||
<td>boo</td> | ||
</tr> | ||
</tbody> | ||
</table> | ||
<div>Some HTML</div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
| abc | def | | ||
| --- | --- | | ||
| bar | foo | | ||
| baz | boo | | ||
<div>Some HTML</div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
<table> | ||
<thead> | ||
<tr> | ||
<th>abc</th> | ||
<th>def</th> | ||
</tr> | ||
</thead> | ||
<tbody> | ||
<tr> | ||
<td>bar</td> | ||
<td>foo</td> | ||
</tr> | ||
<tr> | ||
<td>baz</td> | ||
<td>boo</td> | ||
</tr> | ||
<tr> | ||
<td><code>hello</code></td> | ||
<td></td> | ||
</tr> | ||
</tbody> | ||
</table> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
| abc | def | | ||
| --- | --- | | ||
| bar | foo | | ||
| baz | boo | | ||
`hello` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
<table> | ||
<thead> | ||
<tr> | ||
<th>abc</th> | ||
<th>def</th> | ||
</tr> | ||
</thead> | ||
<tbody> | ||
<tr> | ||
<td>bar</td> | ||
<td>foo</td> | ||
</tr> | ||
<tr> | ||
<td>baz</td> | ||
<td>boo</td> | ||
</tr> | ||
</tbody> | ||
</table> | ||
<h1 id="title">title</h1> | ||
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
| abc | def | | ||
| --- | --- | | ||
| bar | foo | | ||
| baz | boo | | ||
title | ||
===== |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
<table> | ||
<thead> | ||
<tr> | ||
<th>abc</th> | ||
<th>def</th> | ||
</tr> | ||
</thead> | ||
<tbody> | ||
<tr> | ||
<td>bar</td> | ||
<td>foo</td> | ||
</tr> | ||
<tr> | ||
<td>baz</td> | ||
<td>boo</td> | ||
</tr> | ||
</tbody> | ||
</table> | ||
<ul> | ||
<li>foo</li> | ||
<li>bar</li> | ||
<li>baz</li> | ||
</ul> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
| abc | def | | ||
| --- | --- | | ||
| bar | foo | | ||
| baz | boo | | ||
- foo | ||
- bar | ||
- baz |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
<table> | ||
<thead> | ||
<tr> | ||
<th>abc</th> | ||
<th>def</th> | ||
</tr> | ||
</thead> | ||
<tbody> | ||
<tr> | ||
<td>bar</td> | ||
<td>foo</td> | ||
</tr> | ||
<tr> | ||
<td>baz</td> | ||
<td>boo</td> | ||
</tr> | ||
<tr> | ||
<td><strong>strong</strong></td> | ||
<td></td> | ||
</tr> | ||
</tbody> | ||
</table> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
| abc | def | | ||
| --- | --- | | ||
| bar | foo | | ||
| baz | boo | | ||
**strong** |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
<table> | ||
<thead> | ||
<tr> | ||
<th>abc</th> | ||
<th>def</th> | ||
</tr> | ||
</thead> | ||
<tbody> | ||
<tr> | ||
<td>bar</td> | ||
<td>foo</td> | ||
</tr> | ||
<tr> | ||
<td>baz</td> | ||
<td>boo</td> | ||
</tr> | ||
<tr> | ||
<td>hello</td> | ||
<td></td> | ||
</tr> | ||
</tbody> | ||
</table> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
| abc | def | | ||
| --- | --- | | ||
| bar | foo | | ||
| baz | boo | | ||
hello |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
GitHub seems to render this one differently
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmmm.... The spec says "The table is broken at the first empty line, or beginning of another block-level structure", so that would seem to break their rule, as the setext headings fall under the "Leaf Block" category.
At that point do you follow the spec, or do you follow GitHub's implementation of the spec? Either way, it's a simple change of just removing the associated lines that check for
lheading
.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good point, your test seems correct. I also double checked to make sure our GFM spec tests included 201
[extension] Tables
and it is passing.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
from the spec:
Maybe since it cannot interrupt a paragraph it also shouldn't interrupt a table? I'm leaning toward following the implementation and posing this as an issue to GitHub to see what they have to say. github/cmark-gfm#179
We could leave the regex in and just comment it out with a note so we can change it easily in the future.