Skip to content

Commit

Permalink
🐛 Exporting embedded heading blocks without blocks underneath Fix #12075
Browse files Browse the repository at this point in the history
  • Loading branch information
88250 committed Jul 24, 2024
1 parent fc4f614 commit cfdec8f
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion kernel/model/render.go
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,20 @@ func resolveEmbedR(n *ast.Node, blockEmbedMode int, luteEngine *lute.Lute, resol
if "d" == sqlBlock.Type {
subTree, _ := LoadTreeByBlockID(sqlBlock.ID)
md, _ = lute.FormatNodeSync(subTree.Root, luteEngine.ParseOptions, luteEngine.RenderOptions)
} // 标题块不需要再单独解析,直接使用 Markdown,函数开头处会处理
} else if "h" == sqlBlock.Type {
subTree, _ := LoadTreeByBlockID(sqlBlock.ID)
h := treenode.GetNodeInTree(subTree, sqlBlock.ID)
var hChildren []*ast.Node
hChildren = append(hChildren, h)
hChildren = append(hChildren, treenode.HeadingChildren(h)...)
mdBuf := &bytes.Buffer{}
for _, hChild := range hChildren {
md, _ = lute.FormatNodeSync(hChild, luteEngine.ParseOptions, luteEngine.RenderOptions)
mdBuf.WriteString(md)
mdBuf.WriteString("\n\n")
}
md = mdBuf.String()
}

buf := &bytes.Buffer{}
lines := strings.Split(md, "\n")
Expand Down

0 comments on commit cfdec8f

Please sign in to comment.