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

Danielb3074fceead0
diff --git a/app/src/protyle/util/paste.ts b/app/src/protyle/util/paste.ts
index 8e5245ec84..37309c5e98 100644
--- a/app/src/protyle/util/paste.ts
+++ b/app/src/protyle/util/paste.ts
@@ -398,6 +398,7 @@ export const paste = async (protyle: IProtyle, event: (ClipboardEvent | DragEven
// 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) {
@@ -534,6 +535,10 @@ export const paste = async (protyle: IProtyle, event: (ClipboardEvent | DragEven
}
}
}
+
+ // https://github.com/siyuan-note/siyuan/issues/13552
+ textPlain = textPlain.replace(/\u200D```/g, "```");
+
const textPlainDom = protyle.lute.Md2BlockDOM(textPlain);
insertHTML(textPlainDom, protyle, false, false, true);
filterClipboardHint(protyle, textPlain);