🎨 The bound heading block in the database card view displays the sub-blocks in the preview area https://github.com/siyuan-note/siyuan/issues/15288

This commit is contained in:
Daniel 2025-07-13 17:04:21 +08:00
parent 9f01e38c89
commit f17a792b15
No known key found for this signature in database
GPG key ID: 86211BA83DF03017

View file

@ -229,11 +229,23 @@ func renderCoverContentBlock(node *ast.Node, luteEngine *lute.Lute) string {
if isDoc {
node = node.FirstChild
}
heading := node
isHeading := ast.NodeHeading == node.Type
headingLevel := node.HeadingLevel
if isHeading {
node = node.Next
}
buf := bytes.Buffer{}
for c := node; nil != c; c = c.Next {
if isHeading && ast.NodeHeading == c.Type && c.HeadingLevel <= headingLevel {
if 1 > buf.Len() {
buf.WriteString(renderBlockDOMByNode(heading, luteEngine))
}
break
}
buf.WriteString(renderBlockDOMByNode(c, luteEngine))
if !isDoc || 1024*4 < buf.Len() {
if (!isDoc && !isHeading) || 1024*4 < buf.Len() {
break
}
}