删除代码块中的<br />
This commit is contained in:
@@ -4,6 +4,10 @@ function decodeMarkdownEntities($markdown) {
|
|||||||
// $markdown = preg_replace_callback('/(```.*?```|`[^`]*`)/s', function ($matches) {
|
// $markdown = preg_replace_callback('/(```.*?```|`[^`]*`)/s', function ($matches) {
|
||||||
// return htmlentities($matches[0], ENT_QUOTES, 'UTF-8');
|
// return htmlentities($matches[0], ENT_QUOTES, 'UTF-8');
|
||||||
// }, $markdown);
|
// }, $markdown);
|
||||||
|
// Remove <br /> tags in code blocks
|
||||||
|
$markdown = preg_replace_callback('/(```.*?```|`[^`]*`)/s', function ($matches) {
|
||||||
|
return str_replace('<br />', '', $matches[0]);
|
||||||
|
}, $markdown);
|
||||||
|
|
||||||
// Decode HTML entities in inline math and display math
|
// Decode HTML entities in inline math and display math
|
||||||
$markdown = preg_replace_callback('/(\$\$.*?\$\$|\$[^$]*\$)/s', function ($matches) {
|
$markdown = preg_replace_callback('/(\$\$.*?\$\$|\$[^$]*\$)/s', function ($matches) {
|
||||||
|
|||||||
Reference in New Issue
Block a user