单独进行处理
This commit is contained in:
@@ -131,12 +131,21 @@ if ($pr_flag) {
|
||||
// 删除代码块里的html字符防止引起混乱
|
||||
$s = preg_replace_callback('/(```.*?```|`[^`]*`)/s', function ($matches) {
|
||||
$ss = str_replace('<br />', '', $matches[0]);
|
||||
// 大于小于号
|
||||
$ss = htmlspecialchars_decode($ss, ENT_QUOTES | ENT_HTML5);
|
||||
return $ss;
|
||||
}, $s);
|
||||
// 特殊转义
|
||||
$s = str_replace("<br />", "\n", $s);
|
||||
// 把<pre></pre>中间的html字符转成原始字符
|
||||
$s = preg_replace_callback('/<pre>(.*?)<\/pre>/s', function ($matches) {
|
||||
$content = $matches[1];
|
||||
$content = htmlspecialchars_decode($content, ENT_QUOTES);
|
||||
$content = str_replace("<", "<", $content);
|
||||
$content = str_replace(">", ">", $content);
|
||||
$content = str_replace("&", "&", $content);
|
||||
$content = str_replace(""", "\"", $content);
|
||||
$content = str_replace("'", "'", $content);
|
||||
return "<pre>" . $content . "</pre>";
|
||||
}, $s);
|
||||
return $s;
|
||||
}
|
||||
?>
|
||||
|
||||
Reference in New Issue
Block a user