From 5e1d53971951bba6cbc7b8ae3d17f832799db798 Mon Sep 17 00:00:00 2001 From: Liang Ding Date: Tue, 3 Jan 2023 22:57:43 +0800 Subject: [PATCH] =?UTF-8?q?:bug:=20=E6=90=9C=E7=B4=A2=E9=AB=98=E4=BA=AE?= =?UTF-8?q?=E8=B6=85=E9=93=BE=E6=8E=A5=E9=94=9A=E6=96=87=E6=9C=AC=E5=90=8E?= =?UTF-8?q?=E9=A2=84=E8=A7=88=E7=AA=97=E5=8F=A3=E4=BF=AE=E6=94=B9=E5=AF=BC?= =?UTF-8?q?=E8=87=B4=E5=9C=B0=E5=9D=80=E5=A4=B1=E6=95=88=20Fix=20https://g?= =?UTF-8?q?ithub.com/siyuan-note/siyuan/issues/6982?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- kernel/model/search.go | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/kernel/model/search.go b/kernel/model/search.go index 0f11a4dc1..de95a1779 100644 --- a/kernel/model/search.go +++ b/kernel/model/search.go @@ -910,6 +910,23 @@ func markReplaceSpan(n *ast.Node, unlinks *[]*ast.Node, keywords []string, markS c.Type = ast.NodeTextMark c.TextMarkType = n.TextMarkType c.TextMarkTextContent = string(c.Tokens) + if n.IsTextMarkType("a") { + c.TextMarkAHref, c.TextMarkATitle = n.TextMarkAHref, n.TextMarkATitle + } else if n.IsTextMarkType("block-ref") { + c.TextMarkBlockRefID = n.TextMarkBlockRefID + c.TextMarkBlockRefSubtype = n.TextMarkBlockRefSubtype + } else if n.IsTextMarkType("file-annotation-ref") { + c.TextMarkFileAnnotationRefID = n.TextMarkFileAnnotationRefID + } + } else if ast.NodeTextMark == c.Type { + if n.IsTextMarkType("a") { + c.TextMarkAHref, c.TextMarkATitle = n.TextMarkAHref, n.TextMarkATitle + } else if n.IsTextMarkType("block-ref") { + c.TextMarkBlockRefID = n.TextMarkBlockRefID + c.TextMarkBlockRefSubtype = n.TextMarkBlockRefSubtype + } else if n.IsTextMarkType("file-annotation-ref") { + c.TextMarkFileAnnotationRefID = n.TextMarkFileAnnotationRefID + } } children = append(children, c)