1
0
mirror of https://github.com/erusev/parsedown.git synced 2023-08-10 21:13:06 +03:00

Test against HTML block endings

This commit is contained in:
Aidan Woods
2019-02-03 00:07:59 +00:00
parent 14f8ff52e1
commit 08c40afc16
5 changed files with 844 additions and 1 deletions

View File

@@ -27,6 +27,13 @@ final class Markup implements ContinuableBlock
5 => ']]>'
];
/** @var array<string, string> */
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;
}