parent
8ea2b0b63b
commit
e850d48fc3
1 changed files with 12 additions and 5 deletions
|
@ -86,7 +86,8 @@ const plainRules = {
|
||||||
},
|
},
|
||||||
paragraph: {
|
paragraph: {
|
||||||
...defaultRules.paragraph,
|
...defaultRules.paragraph,
|
||||||
plain: (node, output, state) => `${output(node.content, state)}\n\n`,
|
match: blockRegex(/^((?:[^\n]|\n(?! *\n))+)(?:\n *)+\n/),
|
||||||
|
plain: (node, output, state) => `${output(node.content, state)}\n`,
|
||||||
html: (node, output, state) => htmlTag('p', output(node.content, state)),
|
html: (node, output, state) => htmlTag('p', output(node.content, state)),
|
||||||
},
|
},
|
||||||
escape: {
|
escape: {
|
||||||
|
@ -101,9 +102,7 @@ const plainRules = {
|
||||||
text: {
|
text: {
|
||||||
...defaultRules.text,
|
...defaultRules.text,
|
||||||
match: anyScopeRegex(/^[\s\S]+?(?=[^0-9A-Za-z\s\u00c0-\uffff]| *\n|\w+:\S|$)/),
|
match: anyScopeRegex(/^[\s\S]+?(?=[^0-9A-Za-z\s\u00c0-\uffff]| *\n|\w+:\S|$)/),
|
||||||
plain: (node, _, state) => (state.kind === 'edit'
|
plain: (node) => node.content,
|
||||||
? node.content.replace(/(\*|_|!\[|\[|\|\||\$\$?)/g, '\\$1')
|
|
||||||
: node.content),
|
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -138,7 +137,15 @@ const markdownRules = {
|
||||||
},
|
},
|
||||||
blockQuote: {
|
blockQuote: {
|
||||||
...defaultRules.blockQuote,
|
...defaultRules.blockQuote,
|
||||||
plain: (node, output, state) => `> ${output(node.content, state).trim().replace(/\n/g, '\n> ')}\n\n`,
|
match: blockRegex(/^( *>[^\n]+(\n *>+[^\n]+)*\n?)+/),
|
||||||
|
parse: (capture, parse, state) => {
|
||||||
|
const content = capture[0].replace(/^ *> ?/gm, '');
|
||||||
|
return {
|
||||||
|
content: parse(`${content}\n`, state), // TODO: remove /n after fixing paragraph
|
||||||
|
};
|
||||||
|
},
|
||||||
|
plain: (node, output, state) => `> ${output(node.content, state).trim().replace(/\n/g, '\n> ')}`,
|
||||||
|
html: (node, output, state) => htmlTag('blockquote', output(node.content, state)),
|
||||||
},
|
},
|
||||||
list: {
|
list: {
|
||||||
...defaultRules.list,
|
...defaultRules.list,
|
||||||
|
|
Loading…
Reference in a new issue