Skip to content

Commit

Permalink
Bump table priority before code blocks
Browse files Browse the repository at this point in the history
  • Loading branch information
rlidwka committed Oct 30, 2015
1 parent 6bd4534 commit 3488567
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 33 deletions.
2 changes: 1 addition & 1 deletion lib/parser_block.js
Expand Up @@ -12,6 +12,7 @@ var Ruler = require('./ruler');
var _rules = [
// First 2 params - rule name & source. Secondary array - list of rules,
// which can be terminated by this one.
[ 'table', require('./rules_block/table'), [ 'paragraph', 'reference' ] ],
[ 'code', require('./rules_block/code') ],
[ 'fence', require('./rules_block/fence'), [ 'paragraph', 'reference', 'blockquote', 'list' ] ],
[ 'blockquote', require('./rules_block/blockquote'), [ 'paragraph', 'reference', 'list' ] ],
Expand All @@ -21,7 +22,6 @@ var _rules = [
[ 'heading', require('./rules_block/heading'), [ 'paragraph', 'reference', 'blockquote' ] ],
[ 'lheading', require('./rules_block/lheading') ],
[ 'html_block', require('./rules_block/html_block'), [ 'paragraph', 'reference', 'blockquote' ] ],
[ 'table', require('./rules_block/table'), [ 'paragraph', 'reference' ] ],
[ 'paragraph', require('./rules_block/paragraph') ]
];

Expand Down
68 changes: 36 additions & 32 deletions test/fixtures/markdown-it/tables.txt
Expand Up @@ -121,69 +121,50 @@ baz|baz
.


Nested tables inside lists:
Minimal one-column:
.
- foo|foo
---|---
bar|bar
baz|baz
| foo
|----
| test2
.
<ul>
<li>
<table>
<thead>
<tr>
<th>foo</th>
<th>foo</th>
</tr>
</thead>
<tbody>
<tr>
<td>bar</td>
<td>bar</td>
<td>test2</td>
</tr>
</tbody>
</table>
</li>
</ul>
<p>baz|baz</p>
.

Minimal one-column:

This is parsed as one big table:
.
| foo
|----
| test2
- foo|foo
---|---
bar|bar
.
<table>
<thead>
<tr>
<th>- foo</th>
<th>foo</th>
</tr>
</thead>
<tbody>
<tr>
<td>test2</td>
<td>bar</td>
<td>bar</td>
</tr>
</tbody>
</table>
.


Second line indent should not be smaller than first:
.
- foo|foo
---|---
bar|bar
.
<ul>
<li>foo|foo
—|---
bar|bar</li>
</ul>
.


Second line should not contain symbols except "-", ":", "|" and " ":
.
foo|foo
Expand Down Expand Up @@ -438,3 +419,26 @@ Heading 1|Heading 2|Heading 3
</tbody>
</table>
.


Should be parsed before code blocks:
.
foo | bar
----- | -----
aaa | bbb
.
<table>
<thead>
<tr>
<th>foo</th>
<th>bar</th>
</tr>
</thead>
<tbody>
<tr>
<td>aaa</td>
<td>bbb</td>
</tr>
</tbody>
</table>
.

0 comments on commit 3488567

Please sign in to comment.