diff --git a/src/rules.ts b/src/rules.ts index f388280a..45e21992 100644 --- a/src/rules.ts +++ b/src/rules.ts @@ -109,7 +109,7 @@ export const other = { pedanticHeadingBeginRegex: cachedIndentRegex((indent: number) => new RegExp(`^ {0,${indent}}#`)), // a list item ends where a paragraph would be interrupted, so this mirrors the // html start conditions in the paragraph rule below; type 7 is excluded there - htmlBeginRegex: cachedIndentRegex((indent: number) => new RegExp(`^ {0,${indent}}(?:)|<(?:(?:script|pre|style|textarea)(?:[\\s>]|$)|!--)|<\\?| new RegExp(`^ {0,${indent}}(?:)|<(?:(?:script|pre|style|textarea)(?:[\\s>]|$)|!--)|<\\?| new RegExp(`^ {0,${indent}}>`)), // list item and blockquote markers that open nested blocks at the start of a line, as in `- > # heading` nestedContainerMarkers: /^(?: {0,3}(?:(?:[*+-]|\d{1,9}[.)])[ \t]+|>[ \t]?))+/, @@ -179,12 +179,12 @@ const html = edit( + '|[^\\n]*\\n*|$)' // (4) + '|[^\\n]*\\n*|$)' // (5) + '||$)[\\s\\S]*?(?:(?:\\n[ \t]*)+\\n|$)' // (6) -+ '|<(?!(?:script|pre|style|textarea)(?![a-z0-9-]))([a-z][a-z0-9-]*)(?:attribute)*? */?>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ \t]*)+\\n|$)' // (7) open tag ++ '|<(?!(?:script|pre|style|textarea)(?![a-z0-9-]))([a-z][a-z0-9-]*)(?:attribute)*?[ \\t]*/?>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ \t]*)+\\n|$)' // (7) open tag + '|(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ \t]*)+\\n|$)' // (7) closing tag + ')', 'i') .replace('comment', _comment) .replace('tag', _tag) - .replace('attribute', / +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/) + .replace('attribute', /[ \t]+[a-zA-Z:_][\w.:-]*(?:[ \t]*=[ \t]*"[^"\n]*"|[ \t]*=[ \t]*'[^'\n]*'|[ \t]*=[ \t]*[^\s"'=<>`]+)?/) .getRegex(); const createParagraph = (listInterrupt: RegExp) => edit(_paragraph) @@ -195,7 +195,7 @@ const createParagraph = (listInterrupt: RegExp) => edit(_paragraph) .replace('blockquote', ' {0,3}>') .replace('fences', ' {0,3}(?:`{3,}(?=[^`\\n]*(?:\\n|$))|~~~)[^\\n]*(?:\\n|$)') .replace('list', listInterrupt) - .replace('html', ' {0,3}(?:)|<(?:(?:script|pre|style|textarea)(?:[\\s>]|$)|!--)|<\\?|)|<(?:(?:script|pre|style|textarea)(?:[\\s>]|$)|!--)|<\\?|)|<(?:(?:script|pre|style|textarea)(?:[\\s>]|$)|!--)|<\\?|)|<(?:(?:script|pre|style|textarea)(?:[\\s>]|$)|!--)|<\\?| = { .replace('blockquote', ' {0,3}>') .replace('fences', ' {0,3}(?:`{3,}(?=[^`\\n]*(?:\\n|$))|~~~)[^\\n]*(?:\\n|$)') .replace('list', ' {0,3}(?:[*+-]|1[.)])[ \\t]+[^ \\t\\n]') // only non-empty lists starting from 1 can interrupt - .replace('html', ' {0,3}(?:)|<(?:(?:script|pre|style|textarea)(?:[\\s>]|$)|!--)|<\\?|)|<(?:(?:script|pre|style|textarea)(?:[\\s>]|$)|!--)|<\\?| + + + + +

foo

+
+
    +
  • a
  • +
+
diff --git a/test/specs/new/html_block_tabs.md b/test/specs/new/html_block_tabs.md new file mode 100644 index 00000000..4bba860e --- /dev/null +++ b/test/specs/new/html_block_tabs.md @@ -0,0 +1,15 @@ + + + + + + + + + + +foo +
+ +- a +