This commit is contained in:
Tony Brix 2019-06-05 11:04:38 -05:00
parent 396591a2bc
commit 9c91e40e3b
2 changed files with 7 additions and 37 deletions

View File

@ -200,9 +200,7 @@ Lexer.prototype.token = function(src, top) {
l, l,
isordered, isordered,
istask, istask,
ischecked, ischecked;
blockquote,
count;
while (src) { while (src) {
// newline // newline
@ -308,26 +306,16 @@ Lexer.prototype.token = function(src, top) {
type: 'blockquote_start' type: 'blockquote_start'
}); });
blockquote = cap[0].replace(/^ *> ?/gm, ''); cap = cap[0].replace(/^ *> ?/gm, '');
count = 1;
while (blockquote.match(/^ {0,3}>/)) {
count++;
this.tokens.push({
type: 'blockquote_start'
});
blockquote = blockquote.replace(/^ *> ?/gm, '');
}
// Pass `top` to keep the current // Pass `top` to keep the current
// "toplevel" state. This is exactly // "toplevel" state. This is exactly
// how markdown.pl works. // how markdown.pl works.
this.token(blockquote, top); this.token(cap, top);
for (i = 0; i < count; i++) { this.tokens.push({
this.tokens.push({ type: 'blockquote_end'
type: 'blockquote_end' });
});
}
continue; continue;
} }
@ -1253,27 +1241,13 @@ Parser.prototype.tok = function() {
return this.renderer.table(header, body); return this.renderer.table(header, body);
} }
case 'blockquote_start': { case 'blockquote_start': {
var count = 1;
while (this.peek() && this.peek().type === 'blockquote_start') {
this.next();
count++;
}
body = ''; body = '';
while (this.next().type !== 'blockquote_end') { while (this.next().type !== 'blockquote_end') {
body += this.tok(); body += this.tok();
} }
while (this.peek() && this.peek().type === 'blockquote_end') { return this.renderer.blockquote(body);
this.next();
}
for (i = 0; i < count; i++) {
body = this.renderer.blockquote(body);
}
return body;
} }
case 'list_start': { case 'list_start': {
body = ''; body = '';

View File

@ -1,4 +0,0 @@
module.exports = {
markdown: '>'.repeat(5000),
html: '<blockquote>'.repeat(5000) + '</blockquote>'.repeat(5000)
};