fix inline comment and other html blocks
This commit is contained in:
parent
8d07cffadc
commit
e39f1ef07e
10
src/rules.js
10
src/rules.js
@ -18,9 +18,9 @@ const block = {
|
|||||||
html: '^ {0,3}(?:' // optional indentation
|
html: '^ {0,3}(?:' // optional indentation
|
||||||
+ '<(script|pre|style)[\\s>][\\s\\S]*?(?:</\\1>[^\\n]*\\n+|$)' // (1)
|
+ '<(script|pre|style)[\\s>][\\s\\S]*?(?:</\\1>[^\\n]*\\n+|$)' // (1)
|
||||||
+ '|comment[^\\n]*(\\n+|$)' // (2)
|
+ '|comment[^\\n]*(\\n+|$)' // (2)
|
||||||
+ '|<\\?[\\s\\S]*?\\?>\\n*' // (3)
|
+ '|<\\?[\\s\\S]*?(?:\\?>\\n*|$)' // (3)
|
||||||
+ '|<![A-Z][\\s\\S]*?>\\n*' // (4)
|
+ '|<![A-Z][\\s\\S]*?(?:>\\n*|$)' // (4)
|
||||||
+ '|<!\\[CDATA\\[[\\s\\S]*?\\]\\]>\\n*' // (5)
|
+ '|<!\\[CDATA\\[[\\s\\S]*?(?:\\]\\]>\\n*|$)' // (5)
|
||||||
+ '|</?(tag)(?: +|\\n|/?>)[\\s\\S]*?(?:\\n{2,}|$)' // (6)
|
+ '|</?(tag)(?: +|\\n|/?>)[\\s\\S]*?(?:\\n{2,}|$)' // (6)
|
||||||
+ '|<(?!script|pre|style)([a-z][\\w-]*)(?:attribute)*? */?>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:\\n{2,}|$)' // (7) open tag
|
+ '|<(?!script|pre|style)([a-z][\\w-]*)(?:attribute)*? */?>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:\\n{2,}|$)' // (7) open tag
|
||||||
+ '|</(?!script|pre|style)[a-z][\\w-]*\\s*>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:\\n{2,}|$)' // (7) closing tag
|
+ '|</(?!script|pre|style)[a-z][\\w-]*\\s*>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:\\n{2,}|$)' // (7) closing tag
|
||||||
@ -197,6 +197,8 @@ inline.punctuation = edit(inline.punctuation).replace(/punctuation/g, inline._pu
|
|||||||
inline._blockSkip = '\\[[^\\]]*?\\]\\([^\\)]*?\\)|`[^`]*?`|<[^>]*?>';
|
inline._blockSkip = '\\[[^\\]]*?\\]\\([^\\)]*?\\)|`[^`]*?`|<[^>]*?>';
|
||||||
inline._overlapSkip = '__[^_]*?__|\\*\\*\\[^\\*\\]*?\\*\\*';
|
inline._overlapSkip = '__[^_]*?__|\\*\\*\\[^\\*\\]*?\\*\\*';
|
||||||
|
|
||||||
|
inline._comment = edit(block._comment).replace('(?:-->|$)', '-->').getRegex();
|
||||||
|
|
||||||
inline.em.start = edit(inline.em.start)
|
inline.em.start = edit(inline.em.start)
|
||||||
.replace(/punctuation/g, inline._punctuation)
|
.replace(/punctuation/g, inline._punctuation)
|
||||||
.getRegex();
|
.getRegex();
|
||||||
@ -249,7 +251,7 @@ inline.autolink = edit(inline.autolink)
|
|||||||
inline._attribute = /\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/;
|
inline._attribute = /\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/;
|
||||||
|
|
||||||
inline.tag = edit(inline.tag)
|
inline.tag = edit(inline.tag)
|
||||||
.replace('comment', block._comment)
|
.replace('comment', inline._comment)
|
||||||
.replace('attribute', inline._attribute)
|
.replace('attribute', inline._attribute)
|
||||||
.getRegex();
|
.getRegex();
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user