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('|');
|
||||
|
||||
return new
|
||||
RegExp('^([^\\n]+\\n?(?!' + body + '))+\\n*');
|
||||
|
||||
return new
|
||||
RegExp('^([^\\n]+\\n(?!'
|
||||
+ body
|
||||
+ '))+\\n|^([^\\0](?!\\n(?:'
|
||||
+ body
|
||||
+ ')))*$');
|
||||
|
||||
return new
|
||||
RegExp('^([^\\n]+\\n(?!' + body + '))+\\n*|^[^\\0]*$');
|
||||
})();
|
||||
@ -230,15 +240,10 @@ block.token = function(str, tokens, top) {
|
||||
// top-level text
|
||||
if (top && (cap = block.paragraph.exec(str))) {
|
||||
str = str.substring(cap[0].length);
|
||||
// possibly switch to
|
||||
// a "paragraph" token
|
||||
tokens.push({
|
||||
type: 'text',
|
||||
type: 'paragraph',
|
||||
text: cap[0]
|
||||
});
|
||||
tokens.push({
|
||||
type: 'space'
|
||||
});
|
||||
continue;
|
||||
}
|
||||
|
||||
@ -548,6 +553,11 @@ var tok = function() {
|
||||
case 'html': {
|
||||
return inline.lexer(token.text);
|
||||
}
|
||||
case 'paragraph': {
|
||||
return '<p>'
|
||||
+ inline.lexer(token.text)
|
||||
+ '</p>';
|
||||
}
|
||||
case 'text': {
|
||||
return '<p>'
|
||||
+ text()
|
||||
|
Loading…
x
Reference in New Issue
Block a user