mirror of
https://github.com/markedjs/marked.git
synced 2026-11-30 16:48:05 +01:00
fix: keep trailing text on HTML block close line for PI, declarations, and CDATA (#3991)
This commit is contained in:
+3
-3
@@ -151,9 +151,9 @@ const html = edit(
|
||||
'^ {0,3}(?:' // optional indentation
|
||||
+ '<(script|pre|style|textarea)[\\s>][\\s\\S]*?(?:</\\1>[^\\n]*\\n+|$)' // (1)
|
||||
+ '|comment[^\\n]*(\\n+|$)' // (2)
|
||||
+ '|<\\?[\\s\\S]*?(?:\\?>\\n*|$)' // (3)
|
||||
+ '|<![A-Z][\\s\\S]*?(?:>\\n*|$)' // (4)
|
||||
+ '|<!\\[CDATA\\[[\\s\\S]*?(?:\\]\\]>\\n*|$)' // (5)
|
||||
+ '|<\\?[\\s\\S]*?(?:\\?>[^\\n]*\\n+|$)' // (3)
|
||||
+ '|<![A-Z][\\s\\S]*?(?:>[^\\n]*\\n+|$)' // (4)
|
||||
+ '|<!\\[CDATA\\[[\\s\\S]*?(?:\\]\\]>[^\\n]*\\n+|$)' // (5)
|
||||
+ '|</?(tag)(?: +|\\n|/?>)[\\s\\S]*?(?:(?:\\n[ \t]*)+\\n|$)' // (6)
|
||||
+ '|<(?!script|pre|style|textarea)([a-z][\\w-]*)(?:attribute)*? */?>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ \t]*)+\\n|$)' // (7) open tag
|
||||
+ '|</(?!script|pre|style|textarea)[a-z][\\w-]*\\s*>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ \t]*)+\\n|$)' // (7) closing tag
|
||||
|
||||
@@ -0,0 +1,6 @@
|
||||
<?php echo '>'; ?>*not emphasis*
|
||||
<p><em>emphasis</em></p>
|
||||
<!DOCTYPE html>*not emphasis*
|
||||
<p><em>emphasis</em></p>
|
||||
<![CDATA[ raw ]]>*not emphasis*
|
||||
<p><em>emphasis</em></p>
|
||||
@@ -0,0 +1,11 @@
|
||||
---
|
||||
gfm: false
|
||||
---
|
||||
<?php echo '>'; ?>*not emphasis*
|
||||
*emphasis*
|
||||
|
||||
<!DOCTYPE html>*not emphasis*
|
||||
*emphasis*
|
||||
|
||||
<![CDATA[ raw ]]>*not emphasis*
|
||||
*emphasis*
|
||||
Reference in New Issue
Block a user