An open-source, privacy-first, self-hosted knowledge workspace where humans and AI agents work together 开源、隐私优先、自托管的知识工作空间,让人与智能体在此协作
TypeScript agentic-aiai-agentknowledge-baselocal-firstmarkdownmcpmindmapnote-takingself-hostedsiyuanworkspace
:art: 改进建立引用索引 https://github.com/siyuan-note/siyuan/issues/7320
Liang Ding7bdff9eaeb6c
diff --git a/kernel/model/export.go b/kernel/model/export.goindex 8a04d64025..013fecedd6 100644--- a/kernel/model/export.go+++ b/kernel/model/export.go@@ -1362,7 +1362,7 @@ func exportTree(tree *parse.Tree, wysiwyg, expandKaTexMacros, keepFold bool,if n.IsTextMarkType("inline-math") {n.TextMarkInlineMathContent = strings.TrimSpace(n.TextMarkInlineMathContent)return ast.WalkContinue- } else if n.IsTextMarkType("file-annotation-ref") {+ } else if treenode.IsFileAnnotationRef(n) {refID := n.TextMarkFileAnnotationRefIDstatus := processFileAnnotationRef(refID, n, fileAnnotationRefMode)unlinks = append(unlinks, n)diff --git a/kernel/model/index.go b/kernel/model/index.goindex 9c4aa152f6..f03446067a 100644--- a/kernel/model/index.go+++ b/kernel/model/index.go@@ -172,10 +172,8 @@ func IndexRefs() {return ast.WalkContinue}- if n.IsTextMarkType("block-ref") {- defBlockIDs = append(defBlockIDs, n.TextMarkBlockRefID)- } else if n.IsTextMarkType("file-annotation-ref") {- defBlockIDs = append(defBlockIDs, n.TextMarkFileAnnotationRefID)+ if treenode.IsBlockRef(n) || treenode.IsFileAnnotationRef(n) {+ defBlockIDs = append(defBlockIDs, tree.Root.ID)}return ast.WalkContinue})diff --git a/kernel/model/search.go b/kernel/model/search.goindex f7e00c5db9..4168c6b441 100644--- a/kernel/model/search.go+++ b/kernel/model/search.go@@ -943,19 +943,19 @@ func markReplaceSpan(n *ast.Node, unlinks *[]*ast.Node, keywords []string, markSc.TextMarkTextContent = string(c.Tokens)if n.IsTextMarkType("a") {c.TextMarkAHref, c.TextMarkATitle = n.TextMarkAHref, n.TextMarkATitle- } else if n.IsTextMarkType("block-ref") {+ } else if treenode.IsBlockRef(n) {c.TextMarkBlockRefID = n.TextMarkBlockRefIDc.TextMarkBlockRefSubtype = n.TextMarkBlockRefSubtype- } else if n.IsTextMarkType("file-annotation-ref") {+ } else if treenode.IsFileAnnotationRef(n) {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") {+ } else if treenode.IsBlockRef(n) {c.TextMarkBlockRefID = n.TextMarkBlockRefIDc.TextMarkBlockRefSubtype = n.TextMarkBlockRefSubtype- } else if n.IsTextMarkType("file-annotation-ref") {+ } else if treenode.IsFileAnnotationRef(n) {c.TextMarkFileAnnotationRefID = n.TextMarkFileAnnotationRefID}}