diff --git a/src/subParsers/codeSpans.js b/src/subParsers/codeSpans.js index 0abb69ad..dbd85e06 100644 --- a/src/subParsers/codeSpans.js +++ b/src/subParsers/codeSpans.js @@ -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; diff --git a/test/features/tables/table-without-leading-pipe.html b/test/features/tables/table-without-leading-pipe.html new file mode 100644 index 00000000..2b5dd2d8 --- /dev/null +++ b/test/features/tables/table-without-leading-pipe.html @@ -0,0 +1,48 @@ + +

Stats

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
StatusAGENT1AGENT2AGENT3AGENT4AGENT5AGENT6AGENT7AGENT8AGENT9TOTAL
AGENT ERROR000000000
APPROVED000000000
diff --git a/test/features/tables/table-without-leading-pipe.md b/test/features/tables/table-without-leading-pipe.md new file mode 100644 index 00000000..c642428e --- /dev/null +++ b/test/features/tables/table-without-leading-pipe.md @@ -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 |