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

This commit is contained in:
Liang Ding 2023-01-03 10:49:17 +08:00
parent 8f4d20d3dd
commit 24994d993f
No known key found for this signature in database
GPG key ID: 136F30F901A2231D

View file

@ -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
})