Skip to content

Commit

Permalink
fix(tables): fix md tables being parsed inside indented code blocks.
Browse files Browse the repository at this point in the history
Closes #193
  • Loading branch information
tivie committed Aug 27, 2015
1 parent ed2cf59 commit 5025623
Show file tree
Hide file tree
Showing 7 changed files with 23 additions and 7 deletions.
4 changes: 2 additions & 2 deletions dist/showdown.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion dist/showdown.js.map

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions dist/showdown.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/showdown.min.js.map

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion src/subParsers/blockGamut.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@ showdown.subParser('blockGamut', function (text, options, globals) {
text = text.replace(/^[ ]{0,2}([ ]?\-[ ]?){3,}[ \t]*$/gm, key);
text = text.replace(/^[ ]{0,2}([ ]?_[ ]?){3,}[ \t]*$/gm, key);

text = showdown.subParser('tables')(text, options, globals);
text = showdown.subParser('lists')(text, options, globals);
text = showdown.subParser('codeBlocks')(text, options, globals);
text = showdown.subParser('tables')(text, options, globals);

// We already ran _HashHTMLBlocks() before, in Markdown(), but that
// was to escape raw HTML in the original Markdown source. This time,
Expand Down
8 changes: 8 additions & 0 deletions test/features/tables/table-inside-codeblock.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<p>some text</p>

<pre><code>| Tables | Are | Cool |
| ------------- |:-------------:| -----:|
| **col 3 is** | right-aligned | $1600 |
| col 2 is | *centered* | $12 |
| zebra stripes | ~~are neat~~ | $1 |
</code></pre>
8 changes: 8 additions & 0 deletions test/features/tables/table-inside-codeblock.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
some text


| Tables | Are | Cool |
| ------------- |:-------------:| -----:|
| **col 3 is** | right-aligned | $1600 |
| col 2 is | *centered* | $12 |
| zebra stripes | ~~are neat~~ | $1 |

0 comments on commit 5025623

Please sign in to comment.