refactor(hr): speed up hr parsing

speed up horizontal rule parsing by simplifying the regex
This commit is contained in:
Estevao Soares dos Santos 2016-12-17 03:29:53 +00:00
parent f0d25b7bd5
commit 0a856d5394
5 changed files with 3 additions and 3 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

@ -14,9 +14,9 @@ showdown.subParser('blockGamut', function (text, options, globals) {
// Do Horizontal Rules:
var key = showdown.subParser('hashBlock')('<hr />', 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 = text.replace(/^ {0,2}( ?- ?){3,}[ \t]*$/gm, key);
text = text.replace(/^ {0,2}( ?_ ?){3,}[ \t]*$/gm, key);
text = showdown.subParser('lists')(text, options, globals);
text = showdown.subParser('codeBlocks')(text, options, globals);