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/6087
Liang Dingd97254f2124f
diff --git a/kernel/model/template.go b/kernel/model/template.goindex 28d9488f51..8fa3e665b7 100644--- a/kernel/model/template.go+++ b/kernel/model/template.go@@ -196,7 +196,7 @@ func renderTemplate(p, id string) (string, error) {return "", errors.New(msg)}- var nodesNeedAppendChild []*ast.Node+ var nodesNeedAppendChild, unlinks []*ast.Nodeast.Walk(tree.Root, func(n *ast.Node, entering bool) ast.WalkStatus {if !entering {return ast.WalkContinue@@ -213,11 +213,35 @@ func renderTemplate(p, id string) (string, error) {(ast.NodeBlockquote == n.Type && nil != n.FirstChild && nil != n.FirstChild.Next && ast.NodeKramdownBlockIAL == n.FirstChild.Next.Type) {nodesNeedAppendChild = append(nodesNeedAppendChild, n)}++ // 块引缺失锚文本情况下自动补全 https://github.com/siyuan-note/siyuan/issues/6087+ if n.IsTextMarkType("block-ref") {+ if refText := n.Text(); "" == refText {+ refText = sql.GetRefText(n.TextMarkBlockRefID)+ if "" != refText {+ treenode.SetDynamicBlockRefText(n, refText)+ } else {+ unlinks = append(unlinks, n)+ }+ }+ } else if ast.NodeBlockRef == n.Type {+ if idNode := n.ChildByType(ast.NodeBlockRefID); nil != idNode {+ refText := sql.GetRefText(idNode.TokensStr())+ if "" != refText {+ treenode.SetDynamicBlockRefText(n, refText)+ } else {+ unlinks = append(unlinks, n)+ }+ }+ }return ast.WalkContinue})for _, n := range nodesNeedAppendChild {n.AppendChild(parse.NewParagraph())}+ for _, n := range unlinks {+ n.Unlink()+ }// 折叠标题导出为模板后使用会出现内容重复 https://github.com/siyuan-note/siyuan/issues/4488ast.Walk(tree.Root, func(n *ast.Node, entering bool) ast.WalkStatus {