Skip to content

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

:art: Improve display reference counts in the backlink panel https://github.com/siyuan-note/siyuan/issues/13678

Daniel126e8cec82d5
diff --git a/kernel/model/backlink.go b/kernel/model/backlink.go
index ae8478f0dc..9d116cb797 100644
--- a/kernel/model/backlink.go
+++ b/kernel/model/backlink.go
@@ -230,7 +230,7 @@ func buildBacklink(refID string, refTree *parse.Tree, keywords []string, highlig
}
// 反链面板中显示块引用计数 Display reference counts in the backlink panel https://github.com/siyuan-note/siyuan/issues/13618
- fillBlockRefCount(renderNodes, 1)
+ fillBlockRefCount(renderNodes)
dom := renderBlockDOMByNodes(renderNodes, luteEngine)
var blockPaths []*BlockPath
diff --git a/kernel/model/block.go b/kernel/model/block.go
index de375eb0aa..30cbaeb8b4 100644
--- a/kernel/model/block.go
+++ b/kernel/model/block.go
@@ -900,7 +900,7 @@ func getEmbeddedBlock(trees map[string]*parse.Tree, sqlBlock *sql.Block, heading
}
// 嵌入块查询结果中显示块引用计数 https://github.com/siyuan-note/siyuan/issues/7191
- fillBlockRefCount(nodes, 0)
+ fillBlockRefCount(nodes)
luteEngine := NewLute()
luteEngine.RenderOptions.ProtyleContenteditable = false // 不可编辑
diff --git a/kernel/model/render.go b/kernel/model/render.go
index 82d459e206..97b67c087b 100644
--- a/kernel/model/render.go
+++ b/kernel/model/render.go
@@ -144,7 +144,7 @@ func renderBlockText(node *ast.Node, excludeTypes []string, removeLineBreak bool
return
}
-func fillBlockRefCount(nodes []*ast.Node, minRefCount int) {
+func fillBlockRefCount(nodes []*ast.Node) {
var defIDs []string
for _, n := range nodes {
ast.Walk(n, func(n *ast.Node, entering bool) ast.WalkStatus {
@@ -166,7 +166,7 @@ func fillBlockRefCount(nodes []*ast.Node, minRefCount int) {
return ast.WalkContinue
}
- if cnt := refCount[n.ID]; minRefCount < cnt {
+ if cnt := refCount[n.ID]; 0 < cnt {
n.SetIALAttr("refcount", strconv.Itoa(cnt))
}
return ast.WalkContinue