From 1d77722c0e48a520787990a91d743b090183d18c Mon Sep 17 00:00:00 2001 From: klarkxy <278370456@qq.com> Date: Sat, 10 May 2025 16:46:14 +0800 Subject: [PATCH] =?UTF-8?q?=E8=AF=95=E8=AF=95gemini=E7=9A=84=E5=BB=BA?= =?UTF-8?q?=E8=AE=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- web/template/syzoj/problem.php | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/web/template/syzoj/problem.php b/web/template/syzoj/problem.php index 1a7485e..335f4a3 100644 --- a/web/template/syzoj/problem.php +++ b/web/template/syzoj/problem.php @@ -511,19 +511,29 @@ if ($pr_flag) { 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 () { + let raw_markdown_source = $(this).html(); + let decoded_markdown_source = decodeHtmlEntities(raw_markdown_source); + - let markdown_content = marked.parse($(this).html()); + let markdown_content = marked.parse(decoded_markdown_source); const md = window.markdownit(); md.set({ html: true, linkify: true, typographer: true, - }) - let markdown_content = md.render($(this).html()); + }); + let markdown_content = md.render(decoded_markdown_source); - $(this).html(markdown_content) + $(this).html(markdown_content); }); // adding note for ```input1 ```output1 in description for (let i = 1; i < 10; i++) {