pass toplevel state to blockquotes, get rid of extra paragraph rules
This commit is contained in:
parent
73113644cb
commit
332072ffed
@ -47,16 +47,6 @@ block.paragraph = (function() {
|
|||||||
|
|
||||||
return new
|
return new
|
||||||
RegExp('^([^\\n]+\\n?(?!' + body + '))+\\n*');
|
RegExp('^([^\\n]+\\n?(?!' + body + '))+\\n*');
|
||||||
|
|
||||||
return new
|
|
||||||
RegExp('^([^\\n]+\\n(?!'
|
|
||||||
+ body
|
|
||||||
+ '))+\\n|^([^\\0](?!\\n(?:'
|
|
||||||
+ body
|
|
||||||
+ ')))*$');
|
|
||||||
|
|
||||||
return new
|
|
||||||
RegExp('^([^\\n]+\\n(?!' + body + '))+\\n*|^[^\\0]*$');
|
|
||||||
})();
|
})();
|
||||||
|
|
||||||
//block.paragraph = /^([^\n]+\n)+\n+|^[^\0]+$/;
|
//block.paragraph = /^([^\n]+\n)+\n+|^[^\0]+$/;
|
||||||
@ -172,7 +162,10 @@ block.token = function(str, tokens, top) {
|
|||||||
type: 'blockquote_start'
|
type: 'blockquote_start'
|
||||||
});
|
});
|
||||||
cap = cap[0].replace(/^ *>/gm, '');
|
cap = cap[0].replace(/^ *>/gm, '');
|
||||||
block.token(cap, tokens);
|
// pass `top` to keep the current
|
||||||
|
// "toplevel" state. this is exactly
|
||||||
|
// how markdown.pl works.
|
||||||
|
block.token(cap, tokens, top);
|
||||||
tokens.push({
|
tokens.push({
|
||||||
type: 'blockquote_end'
|
type: 'blockquote_end'
|
||||||
});
|
});
|
||||||
@ -237,7 +230,8 @@ block.token = function(str, tokens, top) {
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
// top-level text
|
// optimization for top-level paragraphs.
|
||||||
|
// ignores list-item-looking lines.
|
||||||
if (top && (cap = block.paragraph.exec(str))) {
|
if (top && (cap = block.paragraph.exec(str))) {
|
||||||
str = str.substring(cap[0].length);
|
str = str.substring(cap[0].length);
|
||||||
tokens.push({
|
tokens.push({
|
||||||
|
Loading…
x
Reference in New Issue
Block a user