🎨 Improve block ref anchor text rendering in templates https://github.com/siyuan-note/siyuan/issues/14457

This commit is contained in:
Daniel 2025-03-30 21:34:03 +08:00
parent 86106d62c0
commit 98c51a8fd0
No known key found for this signature in database
GPG key ID: 86211BA83DF03017
2 changed files with 19 additions and 1 deletions

View file

@ -469,6 +469,14 @@ func SetDynamicBlockRefText(blockRef *ast.Node, refText string) {
return
}
if ast.NodeBlockRef == blockRef.Type {
if refID := blockRef.ChildByType(ast.NodeBlockRefID); nil != refID {
refID.InsertAfter(&ast.Node{Type: ast.NodeBlockRefDynamicText, Tokens: []byte(refText)})
refID.InsertAfter(&ast.Node{Type: ast.NodeBlockRefSpace})
}
return
}
refText = strings.TrimSpace(refText)
if "" == refText {
refText = blockRef.TextMarkBlockRefID