Symptoms
The following input causes stackexchange page to freeze (give it a try :P)
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - a
Cause
This is caused by a Catastrophic Backtracking in the horizontal lines regexes. The responsible code should be something like this:
var replacement = "<hr />\n";
text = text.replace(/^[ ]{0,2}([ ]?\*[ ]?){3,}[ \t]*$/gm, replacement);
text = text.replace(/^[ ]{0,2}([ ]?-[ ]?){3,}[ \t]*$/gm, replacement);
text = text.replace(/^[ ]{0,2}([ ]?_[ ]?){3,}[ \t]*$/gm, replacement);
Fix
In order to fix this, the regexes can be simplified:
/^( ?-){3,}[ \t]*$/gm