Эх сурвалжийг харах

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 жил өмнө
parent
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 <%...%>)

Файлын зөрүү хэтэрхий том тул дарагдсан байна
+ 0 - 0
dist/showdown.js.map


Файлын зөрүү хэтэрхий том тул дарагдсан байна
+ 1 - 1
dist/showdown.min.js


Файлын зөрүү хэтэрхий том тул дарагдсан байна
+ 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 <%...%>)

Энэ ялгаанд хэт олон файл өөрчлөгдсөн тул зарим файлыг харуулаагүй болно