various fixes for the blog including prismjs highlighting, colour schemes and embedding media
🚀 Deploy website on push / 🎉 Deploy (push) Failing after 25s

Signed-off-by: rodude123 <rodude123@gmail.com>
This commit is contained in:
2024-06-22 17:46:17 +01:00
parent 646cfa6561
commit 558ac03fbb
11 changed files with 29 additions and 22 deletions
+3 -1
View File
@@ -674,6 +674,7 @@ EOD;
public function changeHTMLSrc(string $body, string $to, string $from): string
{
$htmlDoc = new DOMDocument();
$body = mb_convert_encoding($body, "HTML-ENTITIES", "UTF-8");
$htmlDoc->loadHTML($body, LIBXML_NOERROR);
$doc = $htmlDoc->getElementsByTagName('body')->item(0);
$imgs = $doc->getElementsByTagName('img');
@@ -708,7 +709,8 @@ EOD;
$newBody = '';
foreach ($doc->childNodes as $node)
{
$newBody .= $htmlDoc->saveHTML($node);
$newHTML = $htmlDoc->saveHTML($node);
$newBody .= mb_convert_encoding($newHTML, "UTF-8", mb_detect_encoding($newHTML));
}
return $newBody;
}