From bcff4903f288252fa9562c79ba519f454ac1ab0d Mon Sep 17 00:00:00 2001 From: root Date: Thu, 18 Mar 2021 19:20:49 +0000 Subject: [PATCH] #3 add null question to parsedown-extra, stop escaping HTML --- Helper/MarkdownPlusHelper.php | 2 +- .../erusev/parsedown-extra/ParsedownExtra.php | 17 +++++++++-------- 2 files changed, 10 insertions(+), 9 deletions(-) diff --git a/Helper/MarkdownPlusHelper.php b/Helper/MarkdownPlusHelper.php index b5023db..6ad1fc2 100644 --- a/Helper/MarkdownPlusHelper.php +++ b/Helper/MarkdownPlusHelper.php @@ -58,7 +58,7 @@ public function markdown($text, $isPublicLink = false) { $emoji = new Client(new Ruleset()); $parsecheckbox = new CoreMarkdown($this->container, $isPublicLink); - $parsecheckbox->setMarkupEscaped(MARKDOWN_ESCAPE_HTML); + //$parsecheckbox->setMarkupEscaped(MARKDOWN_ESCAPE_HTML); if ($this->configModel->get('unicode_shortcode', '2') == 1) return $emoji->shortnameToUnicode($parsecheckbox->text($text)); else diff --git a/vendor/erusev/parsedown-extra/ParsedownExtra.php b/vendor/erusev/parsedown-extra/ParsedownExtra.php index be6966d..89772fc 100644 --- a/vendor/erusev/parsedown-extra/ParsedownExtra.php +++ b/vendor/erusev/parsedown-extra/ParsedownExtra.php @@ -237,14 +237,15 @@ protected function blockMarkupComplete($Block) protected function blockSetextHeader($Line, array $Block = null) { $Block = parent::blockSetextHeader($Line, $Block); - - if (preg_match('/[ ]*{('.$this->regexAttribute.'+)}[ ]*$/', $Block['element']['text'], $matches, PREG_OFFSET_CAPTURE)) - { - $attributeString = $matches[1][0]; - - $Block['element']['attributes'] = $this->parseAttributeData($attributeString); - - $Block['element']['text'] = substr($Block['element']['text'], 0, $matches[0][1]); + if (!is_null($Block)) { + if (preg_match('/[ ]*{('.$this->regexAttribute.'+)}[ ]*$/', $Block['element']['text'], $matches, PREG_OFFSET_CAPTURE)) + { + $attributeString = $matches[1][0]; + + $Block['element']['attributes'] = $this->parseAttributeData($attributeString); + + $Block['element']['text'] = substr($Block['element']['text'], 0, $matches[0][1]); + } } return $Block;