Skip to content

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

:art: Improve block ref anchor text exporting Fix https://github.com/siyuan-note/siyuan/issues/11995

Danielbcd12057bccf
diff --git a/kernel/model/export.go b/kernel/model/export.go
index c609f9ca04..b7db9e5739 100644
--- a/kernel/model/export.go
+++ b/kernel/model/export.go
@@ -2009,8 +2009,13 @@ func exportTree(tree *parse.Tree, wysiwyg, keepFold bool,
n.InsertBefore(blockRefLink)
unlinks = append(unlinks, n)
case 3: // 仅锚文本
- blockRefLink := &ast.Node{Type: ast.NodeTextMark, TextMarkType: "text", TextMarkTextContent: linkText}
- blockRefLink.KramdownIAL = n.KramdownIAL
+ var blockRefLink *ast.Node
+ if 0 < len(n.KramdownIAL) {
+ blockRefLink = &ast.Node{Type: ast.NodeTextMark, TextMarkType: "text", TextMarkTextContent: linkText}
+ blockRefLink.KramdownIAL = n.KramdownIAL
+ } else {
+ blockRefLink = &ast.Node{Type: ast.NodeText, Tokens: []byte(linkText)}
+ }
n.InsertBefore(blockRefLink)
unlinks = append(unlinks, n)
case 4: // 脚注