Forráskód Böngészése

fix(comments): Fix html comment parser

When an html comment was followed by a a long line of dashes, it would
freeze the parser as the lookahead in the html comment parser regex was
very slow. The regex was modified and simplified, so no lookahead is
needed anymore.

Closes #276
Estevao Soares dos Santos 9 éve
szülő
commit
238726ca91

+ 2 - 2
dist/showdown.js

@@ -1,4 +1,4 @@
-;/*! showdown 21-06-2016 */
+;/*! showdown 20-07-2016 */
 (function(){
 /**
  * Created by Tivie on 13-07-2015.
@@ -1756,7 +1756,7 @@ showdown.subParser('hashHTMLBlocks', function (text, options, globals) {
     showdown.subParser('hashElement')(text, options, globals));
 
   // Special case for standalone HTML comments:
-  text = text.replace(/(<!(--[^\r]*?--\s*)+>[ \t]*(?=\n{2,}))/g,
+  text = text.replace(/(<!--[\s\S]*?-->)/g,
     showdown.subParser('hashElement')(text, options, globals));
 
   // PHP and ASP-style processor instructions (<?...?> and <%...%>)

A különbségek nem kerülnek megjelenítésre, a fájl túl nagy
+ 0 - 0
dist/showdown.js.map


A különbségek nem kerülnek megjelenítésre, a fájl túl nagy
+ 1 - 1
dist/showdown.min.js


A különbségek nem kerülnek megjelenítésre, a fájl túl nagy
+ 0 - 0
dist/showdown.min.js.map


+ 1 - 1
src/subParsers/hashHTMLBlocks.js

@@ -56,7 +56,7 @@ showdown.subParser('hashHTMLBlocks', function (text, options, globals) {
     showdown.subParser('hashElement')(text, options, globals));
 
   // Special case for standalone HTML comments:
-  text = text.replace(/(<!(--[^\r]*?--\s*)+>[ \t]*(?=\n{2,}))/g,
+  text = text.replace(/(<!--[\s\S]*?-->)/g,
     showdown.subParser('hashElement')(text, options, globals));
 
   // PHP and ASP-style processor instructions (<?...?> and <%...%>)

Nem az összes módosított fájl került megjelenítésre, mert túl sok fájl változott