fix syntax highlighter

This commit is contained in:
lolcat 2025-08-10 17:15:42 -04:00
parent dea8b0a362
commit 2c2bd28a9f
1 changed files with 18 additions and 23 deletions

View File

@ -402,29 +402,24 @@ class frontend{
$text = $text =
trim( trim(
preg_replace(
'/<\/span>$/',
"", // remove stray ending span because of the <?php stuff
str_replace( str_replace(
[ [
'<br />', "<br />",
'&nbsp;' "&nbsp;",
"<pre>",
"</pre>"
], ],
[ [
"\n", // replace <br> with newlines "\n",
" " // replace html entity to space
],
str_replace(
[
// leading <?php garbage
"<span style=\"color: c-default\">\n&lt;?php&nbsp;",
"<code>",
"</code>"
],
" ", " ",
highlight_string("<?php " . $text, true) "",
) ""
) ],
explode(
"&lt;?php",
highlight_string("<?php " . $text, true),
2
)[1]
) )
); );