mirror of
https://github.com/siyuan-note/siyuan.git
synced 2025-05-03 05:40:10 +08:00
🎨 Referenced blocks support rendering virtual references https://github.com/siyuan-note/siyuan/issues/10960
This commit is contained in:
parent
b3a2c49f15
commit
5e116a16d2
@ -144,7 +144,7 @@ func AddVirtualBlockRefExclude(keyword []string) {
|
||||
}
|
||||
|
||||
func processVirtualRef(n *ast.Node, unlinks *[]*ast.Node, virtualBlockRefKeywords []string, refCount map[string]int, luteEngine *lute.Lute) bool {
|
||||
if !Conf.Editor.VirtualBlockRef {
|
||||
if !Conf.Editor.VirtualBlockRef || 1 > len(virtualBlockRefKeywords) {
|
||||
return false
|
||||
}
|
||||
|
||||
@ -153,12 +153,15 @@ func processVirtualRef(n *ast.Node, unlinks *[]*ast.Node, virtualBlockRefKeyword
|
||||
}
|
||||
|
||||
parentBlock := treenode.ParentBlock(n)
|
||||
if nil == parentBlock || 0 < refCount[parentBlock.ID] {
|
||||
if nil == parentBlock {
|
||||
return false
|
||||
}
|
||||
|
||||
if 1 > len(virtualBlockRefKeywords) {
|
||||
return false
|
||||
if 0 < refCount[parentBlock.ID] {
|
||||
// 如果块被引用过,则将其自身的文本排除在虚拟引用关键字之外
|
||||
// Referenced blocks support rendering virtual references https://github.com/siyuan-note/siyuan/issues/10960
|
||||
parentText := getNodeRefText(parentBlock)
|
||||
virtualBlockRefKeywords = gulu.Str.RemoveElem(virtualBlockRefKeywords, parentText)
|
||||
}
|
||||
|
||||
content := string(n.Tokens)
|
||||
|
Loading…
Reference in New Issue
Block a user