Skip to content

Commit

Permalink
added check for undefined on text due to failing to parse tables
Browse files Browse the repository at this point in the history
  • Loading branch information
stewartmckee committed May 24, 2016
1 parent 94ec12b commit 6e30a48
Show file tree
Hide file tree
Showing 3 changed files with 60 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/subParsers/codeSpans.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,10 @@ showdown.subParser('codeSpans', function (text, options, globals) {
(?!`)
/gm, function(){...});
*/

if (typeof(text) === 'undefined') {
text = '';
}
text = text.replace(/(^|[^\\])(`+)([^\r]*?[^`])\2(?!`)/gm,
function (wholeMatch, m1, m2, m3) {
var c = m3;
Expand Down
48 changes: 48 additions & 0 deletions test/features/tables/table-without-leading-pipe.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@

<h3 id="stats">Stats</h3>

<table>
<thead>
<tr>
<th>Status</th>
<th>AGENT1</th>
<th>AGENT2</th>
<th>AGENT3</th>
<th>AGENT4</th>
<th>AGENT5</th>
<th>AGENT6</th>
<th>AGENT7</th>
<th>AGENT8</th>
<th>AGENT9</th>
<th>TOTAL</th>
</tr>
</thead>
<tbody>
<tr>
<td>AGENT ERROR</td>
<td>0</td>
<td>0</td>
<td>0</td>
<td>0</td>
<td>0</td>
<td>0</td>
<td>0</td>
<td>0</td>
<td>0</td>
<td></td>
</tr>
<tr>
<td>APPROVED</td>
<td>0</td>
<td>0</td>
<td>0</td>
<td>0</td>
<td>0</td>
<td>0</td>
<td>0</td>
<td>0</td>
<td>0</td>
<td></td>
</tr>
</tbody>
</table>
8 changes: 8 additions & 0 deletions test/features/tables/table-without-leading-pipe.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@

### Stats


Status | AGENT1 | AGENT2 | AGENT3 | AGENT4 | AGENT5 | AGENT6 | AGENT7 | AGENT8 | AGENT9 | TOTAL |
--- | --- | --- | --- | --- | --- | --- | --- | --- | --- |
AGENT ERROR | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 |
APPROVED | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 |

0 comments on commit 6e30a48

Please sign in to comment.