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++) {