add paragraph token, fix paragraph rule
This commit is contained in:
parent
75bf7ec7ed
commit
73113644cb
@ -45,6 +45,16 @@ block.paragraph = (function() {
|
|||||||
|
|
||||||
body = body.join('|');
|
body = body.join('|');
|
||||||
|
|
||||||
|
return new
|
||||||
|
RegExp('^([^\\n]+\\n?(?!' + body + '))+\\n*');
|
||||||
|
|
||||||
|
return new
|
||||||
|
RegExp('^([^\\n]+\\n(?!'
|
||||||
|
+ body
|
||||||
|
+ '))+\\n|^([^\\0](?!\\n(?:'
|
||||||
|
+ body
|
||||||
|
+ ')))*$');
|
||||||
|
|
||||||
return new
|
return new
|
||||||
RegExp('^([^\\n]+\\n(?!' + body + '))+\\n*|^[^\\0]*$');
|
RegExp('^([^\\n]+\\n(?!' + body + '))+\\n*|^[^\\0]*$');
|
||||||
})();
|
})();
|
||||||
@ -230,15 +240,10 @@ block.token = function(str, tokens, top) {
|
|||||||
// top-level text
|
// top-level text
|
||||||
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);
|
||||||
// possibly switch to
|
|
||||||
// a "paragraph" token
|
|
||||||
tokens.push({
|
tokens.push({
|
||||||
type: 'text',
|
type: 'paragraph',
|
||||||
text: cap[0]
|
text: cap[0]
|
||||||
});
|
});
|
||||||
tokens.push({
|
|
||||||
type: 'space'
|
|
||||||
});
|
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -548,6 +553,11 @@ var tok = function() {
|
|||||||
case 'html': {
|
case 'html': {
|
||||||
return inline.lexer(token.text);
|
return inline.lexer(token.text);
|
||||||
}
|
}
|
||||||
|
case 'paragraph': {
|
||||||
|
return '<p>'
|
||||||
|
+ inline.lexer(token.text)
|
||||||
|
+ '</p>';
|
||||||
|
}
|
||||||
case 'text': {
|
case 'text': {
|
||||||
return '<p>'
|
return '<p>'
|
||||||
+ text()
|
+ text()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user