使用text而非html保证markdown不会被修改

This commit is contained in:
2025-05-10 16:14:33 +08:00
parent 06b4e61de1
commit b3f23cf2f0

View File

@@ -513,7 +513,7 @@ if ($pr_flag) {
$(".md").each(function () {
<?php if (isset($OJ_MARKDOWN) && $OJ_MARKDOWN == "marked.js") { ?>
$(this).html(marked.parse($(this).html()));
$(this).text(marked.parse($(this).html()));
<?php } else if (isset($OJ_MARKDOWN) && $OJ_MARKDOWN == "markdown-it") { ?>
const md = window.markdownit();
md.set({
@@ -521,7 +521,7 @@ if ($pr_flag) {
linkify: true,
typographer: true,
})
$(this).html(md.render($(this).html()));
$(this).text(md.render($(this).html()));
<?php } ?>
});
// adding note for ```input1 ```output1 in description