From 49bb5d56a4c0b5d9761e21b3b8faaf9a1c0c870c Mon Sep 17 00:00:00 2001 From: Daniel <845765@qq.com> Date: Mon, 20 May 2024 22:55:09 +0800 Subject: [PATCH] :art: Improve block ref text copying https://github.com/siyuan-note/siyuan/issues/11473 --- kernel/api/block.go | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/kernel/api/block.go b/kernel/api/block.go index e9b5049bc..addafe6cd 100644 --- a/kernel/api/block.go +++ b/kernel/api/block.go @@ -20,6 +20,7 @@ import ( "errors" "fmt" "net/http" + "strings" "github.com/88250/gulu" "github.com/88250/lute/html" @@ -352,7 +353,17 @@ func getRefText(c *gin.Context) { if "" == refText { // 空块返回 id https://github.com/siyuan-note/siyuan/issues/10259 refText = id + ret.Data = refText + return } + + if strings.Count(refText, "\\") == len(refText) { + // 全部都是 \ 的话使用实体 https://github.com/siyuan-note/siyuan/issues/11473 + refText = strings.ReplaceAll(refText, "\\", "\") + ret.Data = refText + return + } + ret.Data = refText }