Skip to content

Commit

Permalink
fix(paragraph): workaround QML bug
Browse files Browse the repository at this point in the history
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
  • Loading branch information
tivie committed Feb 5, 2017
1 parent a029ab3 commit f7a429e
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 8 deletions.
5 changes: 3 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.

6 changes: 3 additions & 3 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.

3 changes: 2 additions & 1 deletion src/subParsers/paragraphs.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down

1 comment on commit f7a429e

@qyvlik
Copy link

@qyvlik qyvlik commented on f7a429e Feb 7, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice~ Thank for fix this bug.

Please sign in to comment.