试试gemini的建议

This commit is contained in:
2025-05-10 16:46:14 +08:00
parent 4d65c23bdf
commit 1d77722c0e

View File

@@ -511,19 +511,29 @@ if ($pr_flag) {
headerIds: false headerIds: false
}); });
// Helper function to decode HTML entities from Markdown source
function decodeHtmlEntities(text) {
var textArea = document.createElement('textarea');
textArea.innerHTML = text;
return textArea.value;
}
$(".md").each(function () { $(".md").each(function () {
let raw_markdown_source = $(this).html();
let decoded_markdown_source = decodeHtmlEntities(raw_markdown_source);
<?php if ( $OJ_MARKDOWN == "marked.js") { ?> <?php if ( $OJ_MARKDOWN == "marked.js") { ?>
let markdown_content = marked.parse($(this).html()); let markdown_content = marked.parse(decoded_markdown_source);
<?php } else if ($OJ_MARKDOWN == "markdown-it") { ?> <?php } else if ($OJ_MARKDOWN == "markdown-it") { ?>
const md = window.markdownit(); const md = window.markdownit();
md.set({ md.set({
html: true, html: true,
linkify: true, linkify: true,
typographer: true, typographer: true,
}) });
let markdown_content = md.render($(this).html()); let markdown_content = md.render(decoded_markdown_source);
<?php } ?> <?php } ?>
$(this).html(markdown_content) $(this).html(markdown_content);
}); });
// adding note for ```input1 ```output1 in description // adding note for ```input1 ```output1 in description
for (let i = 1; i < 10; i++) { for (let i = 1; i < 10; i++) {