diff options
author | Freya Murphy <freya@freyacat.org> | 2024-12-11 17:11:22 -0500 |
---|---|---|
committer | Freya Murphy <freya@freyacat.org> | 2024-12-11 17:11:22 -0500 |
commit | abd24964e2d167613dd78e5b5f0efc163e2fe3d2 (patch) | |
tree | 16999d9896f31540c09b5912b77e5dd12a0631b3 /src/web/third_party/parsedown_extra.php | |
parent | fix git url (diff) | |
download | website-abd24964e2d167613dd78e5b5f0efc163e2fe3d2.tar.gz website-abd24964e2d167613dd78e5b5f0efc163e2fe3d2.tar.bz2 website-abd24964e2d167613dd78e5b5f0efc163e2fe3d2.zip |
update third party libraries
Diffstat (limited to '')
-rw-r--r-- | src/web/third_party/parsedown_extra.php | 19 |
1 files changed, 11 insertions, 8 deletions
diff --git a/src/web/third_party/parsedown_extra.php b/src/web/third_party/parsedown_extra.php index 8cdb5d2..b3298d5 100644 --- a/src/web/third_party/parsedown_extra.php +++ b/src/web/third_party/parsedown_extra.php @@ -17,7 +17,7 @@ class ParsedownExtra extends Parsedown { # ~ - const version = '0.8.0'; + const version = '0.8.2'; # ~ @@ -331,7 +331,7 @@ class ParsedownExtra extends Parsedown # # Setext - protected function blockSetextHeader($Line, array $Block = null) + protected function blockSetextHeader($Line, ?array $Block = null) { $Block = parent::blockSetextHeader($Line, $Block); @@ -508,7 +508,7 @@ class ParsedownExtra extends Parsedown ), ); - uasort($this->DefinitionData['Footnote'], 'self::sortFootnotes'); + uasort($this->DefinitionData['Footnote'], [$this, 'sortFootnotes']); foreach ($this->DefinitionData['Footnote'] as $definitionId => $DefinitionData) { @@ -624,12 +624,15 @@ class ParsedownExtra extends Parsedown $DOMDocument = new DOMDocument; - # http://stackoverflow.com/q/11309194/200145 - $elementMarkup = mb_convert_encoding($elementMarkup, 'HTML-ENTITIES', 'UTF-8'); - - # http://stackoverflow.com/q/4879946/200145 - $DOMDocument->loadHTML($elementMarkup); + # https://www.php.net/manual/en/domdocument.loadhtml.php#95251 + $DOMDocument->loadHTML('<?xml encoding="UTF-8"?>' . $elementMarkup); $DOMDocument->removeChild($DOMDocument->doctype); + foreach ($DOMDocument->childNodes as $Node) { + if ($Node->nodeType === XML_PI_NODE) { + $DOMDocument->removeChild($Node); + } + } + $DOMDocument->encoding = 'UTF-8'; $DOMDocument->replaceChild($DOMDocument->firstChild->firstChild->firstChild, $DOMDocument->firstChild); $elementText = ''; |