增加markdown-it的选项

This commit is contained in:
2024-12-06 17:12:45 +08:00
parent 6219b4ea1a
commit 006822c9bb

View File

@@ -123,9 +123,9 @@ if ($pr_flag) {
{
$s = $str;
if (strpos($s, "class='md") !== false) // 没找到,那就加上
$s = "<span class='md'>" . $s ."</span>";
$s = "<span class='md'>" . $s . "</span>";
$s = bbcode_to_html($s);
return $s;
return $s;
}
?>
<div class="row">
@@ -475,7 +475,11 @@ if ($pr_flag) {
<?php if ($OJ_MARKDOWN && $OJ_MARKDOWN == "marked.js") { ?>
$(this).html(marked.parse($(this).html()));
<?php } else if ($OJ_MARKDOWN && $OJ_MARKDOWN == "markdown-it") { ?>
const md = window.markdownit();
const md = window.markdownit()({
html: true,
linkify: true,
typographer: true
});
$(this).html(md.render($(this).text()));
<?php } ?>
});