use faster text rule
This commit is contained in:
parent
c5664e4bbf
commit
b52e40a322
@ -288,31 +288,10 @@ var inline = {
|
|||||||
em: /^\b_([^\0]+?)_\b|^\*((?:\*\*|[^\0])+?)\*(?!\*)/,
|
em: /^\b_([^\0]+?)_\b|^\*((?:\*\*|[^\0])+?)\*(?!\*)/,
|
||||||
code: /^(`+)([^\0]*?[^`])\1(?!`)/,
|
code: /^(`+)([^\0]*?[^`])\1(?!`)/,
|
||||||
br: /^ {2,}\n(?!\s*$)/,
|
br: /^ {2,}\n(?!\s*$)/,
|
||||||
text: /^[^\0]+?(?=body|$)/
|
text: /^[^\0]+?(?=[\\<!\[_*`]|\w+:\/\/| {2,}\n|$)/
|
||||||
|
//text: /^[^\0]+?(?=\\|\w+:\/\/|<|!?\[|_|\*|`| {2,}\n|$)/
|
||||||
};
|
};
|
||||||
|
|
||||||
inline.text = (function() {
|
|
||||||
var text = inline.text.source
|
|
||||||
, body = [];
|
|
||||||
|
|
||||||
(function push(rule) {
|
|
||||||
rule = inline[rule].source;
|
|
||||||
body.push(rule.replace(/(^|[^\[])\^/g, '$1'));
|
|
||||||
return push;
|
|
||||||
})
|
|
||||||
('escape')
|
|
||||||
('gfm_autolink')
|
|
||||||
('tag')
|
|
||||||
('nolink')
|
|
||||||
('strong')
|
|
||||||
('em')
|
|
||||||
('code')
|
|
||||||
('br');
|
|
||||||
|
|
||||||
return new
|
|
||||||
RegExp(text.replace('body', body.join('|')));
|
|
||||||
})();
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Inline Lexer
|
* Inline Lexer
|
||||||
*/
|
*/
|
||||||
|
Loading…
x
Reference in New Issue
Block a user