From 528283001b6c44f51f398cb0756edacda3b6e5f1 Mon Sep 17 00:00:00 2001 From: Daniel <845765@qq.com> Date: Sat, 27 May 2023 10:50:22 +0800 Subject: [PATCH] :art: Paste code from IDE no longer escape `<` and `>` Fix https://github.com/siyuan-note/siyuan/issues/8340 --- app/src/protyle/util/processCode.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/app/src/protyle/util/processCode.ts b/app/src/protyle/util/processCode.ts index 3c2622535..31203b4e3 100644 --- a/app/src/protyle/util/processCode.ts +++ b/app/src/protyle/util/processCode.ts @@ -29,10 +29,12 @@ export const processPasteCode = (html: string, text: string) => { } if (isCode) { - const code = text || html; + let code = text || html; if (/\n/.test(code)) { return `
${window.siyuan.storage[Constants.LOCAL_CODELANG]}
${code.replace(/&/g, "&").replace(/
${Constants.ZWSP}
`; } else { + // Paste code from IDE no longer escape `<` and `>` https://github.com/siyuan-note/siyuan/issues/8340 + code = code.replace("<", "<").replace('>', ">"); return "`" + code + "`"; } }