Skip to content

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

:bug: 引用嵌套容器块触发状态异常 Fix https://github.com/siyuan-note/siyuan/issues/6967

Liang Ding24994d993fdf
diff --git a/kernel/sql/block_query.go b/kernel/sql/block_query.go
index 134d4f9564..3dba9bcda9 100644
--- a/kernel/sql/block_query.go
+++ b/kernel/sql/block_query.go
@@ -656,10 +656,20 @@ func GetContainerText(container *ast.Node) string {
return ast.WalkContinue
}
switch n.Type {
- case ast.NodeText, ast.NodeLinkText, ast.NodeCodeBlockCode, ast.NodeMathBlockContent:
+ case ast.NodeText, ast.NodeLinkText, ast.NodeFileAnnotationRefText, ast.NodeCodeBlockCode, ast.NodeMathBlockContent:
buf.Write(n.Tokens)
case ast.NodeTextMark:
buf.WriteString(n.Content())
+ case ast.NodeBlockRef:
+ if anchor := n.ChildByType(ast.NodeBlockRefText); nil != anchor {
+ buf.WriteString(anchor.Text())
+ } else if anchor = n.ChildByType(ast.NodeBlockRefDynamicText); nil != anchor {
+ buf.WriteString(anchor.Text())
+ } else {
+ text := GetRefText(n.TokensStr())
+ buf.WriteString(text)
+ }
+ return ast.WalkSkipChildren
}
return ast.WalkContinue
})