Merge pull request #628 from aidantwoods/fix/revert-rawHtml-breaks-insertion

Preserve plain-text in AST to avoid blinding extensions to it
This commit is contained in:
Aidan Woods 2018-05-08 22:41:44 +01:00 committed by GitHub
commit c83af0a7d5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1215,14 +1215,14 @@ class Parsedown
'element' => array(), 'element' => array(),
); );
$safeText = self::escape($text, true); $Inline['element']['elements'] = self::pregReplaceElements(
$Inline['element']['rawHtml'] = preg_replace(
$this->breaksEnabled ? '/[ ]*+\n/' : '/(?:[ ]*+\\\\|[ ]{2,}+)\n/', $this->breaksEnabled ? '/[ ]*+\n/' : '/(?:[ ]*+\\\\|[ ]{2,}+)\n/',
"<br />\n", array(
$safeText array('name' => 'br'),
array('text' => "\n"),
),
$text
); );
$Inline['element']['allowRawHtmlInSafeMode'] = true;
return $Inline; return $Inline;
} }