diff --git a/src/Components/Blocks/Markup.php b/src/Components/Blocks/Markup.php index 95a373d..512036c 100644 --- a/src/Components/Blocks/Markup.php +++ b/src/Components/Blocks/Markup.php @@ -27,6 +27,13 @@ final class Markup implements ContinuableBlock 5 => ']]>' ]; + /** @var array */ + private static $specialHtmlBlockTags = [ + 'script' => true, + 'style' => true, + 'pre' => true, + ]; + /** @var string */ private $html; @@ -85,7 +92,10 @@ final class Markup implements ContinuableBlock if (\preg_match('/^<[\/]?+(\w++)(?:[ ]*+'.self::REGEX_HTML_ATTRIBUTE.')*+[ ]*+(\/)?>/', $text, $matches)) { $element = \strtolower($matches[1]); - if (\array_key_exists($element, Element::$TEXT_LEVEL_ELEMENTS)) { + if ( + \array_key_exists($element, Element::$TEXT_LEVEL_ELEMENTS) + || \array_key_exists($element, self::$specialHtmlBlockTags) + ) { return null; } diff --git a/tests/commonmark/117-HTML_blocks.html b/tests/commonmark/117-HTML_blocks.html new file mode 100644 index 0000000..568cb0e --- /dev/null +++ b/tests/commonmark/117-HTML_blocks.html @@ -0,0 +1,6 @@ +
+
+**Hello**,
+

world. +

+
\ No newline at end of file diff --git a/tests/commonmark/117-HTML_blocks.md b/tests/commonmark/117-HTML_blocks.md new file mode 100644 index 0000000..2c31bb2 --- /dev/null +++ b/tests/commonmark/117-HTML_blocks.md @@ -0,0 +1,7 @@ +
+
+**Hello**,
+
+_world_.
+
+
\ No newline at end of file diff --git a/tests/data/markup_end_conditions.html b/tests/data/markup_end_conditions.html new file mode 100644 index 0000000..90d2112 --- /dev/null +++ b/tests/data/markup_end_conditions.html @@ -0,0 +1,337 @@ +