Skip to content

An open-source, privacy-first, self-hosted knowledge workspace where humans and AI agents work together 开源、隐私优先、自托管的知识工作空间,让人与智能体在此协作

:art: Improve Markdown code block parsing https://github.com/siyuan-note/siyuan/issues/13552

Daniel93a3915f0cb5
diff --git a/app/src/protyle/util/paste.ts b/app/src/protyle/util/paste.ts
index f87de12739..8e5245ec84 100644
--- a/app/src/protyle/util/paste.ts
+++ b/app/src/protyle/util/paste.ts
@@ -395,6 +395,9 @@ export const paste = async (protyle: IProtyle, event: (ClipboardEvent | DragEven
const range = getEditorRange(protyle.wysiwyg.element);
if (nodeElement.getAttribute("data-type") === "NodeCodeBlock" ||
protyle.toolbar.getCurrentType(range).includes("code")) {
+ // https://github.com/siyuan-note/siyuan/issues/13552
+ textPlain = textPlain.replace(/\u200D```/g, "```");
+ textPlain = textPlain.replace(/```/g, "\u200D```");
insertHTML(textPlain, protyle);
return;
} else if (siyuanHTML) {