Skip to content

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

:art: 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

Danielf17a792b15d3
diff --git a/kernel/sql/av_gallery.go b/kernel/sql/av_gallery.go
index 4d61ddbe82..d4e937b818 100644
--- a/kernel/sql/av_gallery.go
+++ b/kernel/sql/av_gallery.go
@@ -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
}
}