Only allow a recursive depth of 3 for markdown links.

This commit is contained in:
Robin Ward 2013-12-08 22:22:08 -05:00
parent 6ebc2dcf5c
commit 64a3afe35a

View File

@ -1250,6 +1250,15 @@
"[": function link( text ) {
var open = 1;
for (var i=0; i<text.length; i++) {
var c = text.charAt(i);
if (c === '[') { open++; }
if (c === ']') { open--; }
if (open > 3) { return [1, "["]; }
}
var orig = String(text);
// Inline content is possible inside `link text`
var res = inline_until_char.call( this, text.substr(1), "]" );