fix(subparsers/tables.js): fix parser order so that tables include all spanGamut elements

This commit is contained in:
Estevão Soares dos Santos 2015-07-11 19:50:26 +01:00
parent 0a3a0df6bf
commit 5ec75c459b
8 changed files with 36 additions and 1 deletions

BIN
dist/showdown.js vendored

Binary file not shown.

BIN
dist/showdown.js.map vendored

Binary file not shown.

BIN
dist/showdown.min.js vendored

Binary file not shown.

Binary file not shown.

View File

@ -44,7 +44,6 @@ showdown.Converter = function (converterOptions) {
* @type {string[]} * @type {string[]}
*/ */
parserOrder = [ parserOrder = [
'tables',
'githubCodeBlocks', 'githubCodeBlocks',
'hashHTMLBlocks', 'hashHTMLBlocks',
'stripLinkDefinitions', 'stripLinkDefinitions',

View File

@ -13,6 +13,7 @@ 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 = 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('lists')(text, options, globals);
text = showdown.subParser('codeBlocks')(text, options, globals); text = showdown.subParser('codeBlocks')(text, options, globals);
text = showdown.subParser('blockQuotes')(text, options, globals); text = showdown.subParser('blockQuotes')(text, options, globals);

View File

@ -0,0 +1,26 @@
<table>
<thead>
<tr>
<th>First Header</th>
<th>Second Header</th>
</tr>
</thead>
<tbody>
<tr>
<td><strong>bold</strong></td>
<td><img src="foo.jpg" alt="img" /></td>
</tr>
<tr>
<td><em>italic</em></td>
<td><a href="bla.html">link</a></td>
</tr>
<tr>
<td><code>some code</code></td>
<td><a href="www.google.com">google</a></td>
</tr>
<tr>
<td><a href="www.foo.com">www.foo.com</a></td>
<td>normal</td>
</tr>
</tbody>
</table>

View File

@ -0,0 +1,9 @@
| First Header | Second Header |
| ------------- | ----------------- |
| **bold** | ![img](foo.jpg) |
| _italic_ | [link](bla.html) |
| `some code` | [google][1] |
| <www.foo.com> | normal |
[1]: www.google.com