mirror of
https://github.com/siyuan-note/siyuan.git
synced 2026-01-03 15:28:49 +01:00
🎨 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:
parent
9f01e38c89
commit
f17a792b15
1 changed files with 13 additions and 1 deletions
|
|
@ -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
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue