fix(paragraph): workaround QML bug

QML has a bug that changes the behavior or String.search().
This prevents blocks from being correctly unhashified.
This commit works around that bug, using RegExp.test
instead of String.search.
Credits to @qyvlik

Closes #246, Closes #338
This commit is contained in:
Estevao Soares dos Santos 2017-02-05 19:57:24 +00:00
parent a029ab3127
commit f7a429e8db
5 changed files with 2 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

@ -36,7 +36,8 @@ showdown.subParser('paragraphs', function (text, options, globals) {
grafsOutIt = grafsOut[i],
codeFlag = false;
// if this is a marker for an html block...
while (grafsOutIt.search(/¨(K|G)(\d+)\1/) >= 0) {
// use RegExp.test instead of string.search because of QML bug
while (/¨(K|G)(\d+)\1/.test(grafsOutIt)) {
var delim = RegExp.$1,
num = RegExp.$2;