An open-source, privacy-first, self-hosted knowledge workspace where humans and AI agents work together 开源、隐私优先、自托管的知识工作空间,让人与智能体在此协作
TypeScript agentic-aiai-agentknowledge-baselocal-firstmarkdownmcpmindmapnote-takingself-hostedsiyuanworkspace
:art: Improve export of heading levels in embedded blocks https://github.com/siyuan-note/siyuan/issues/12741
Daniel759e5c5a9de3
diff --git a/kernel/model/render.go b/kernel/model/render.goindex d04f9dbf86..4300b6eb80 100644--- a/kernel/model/render.go+++ b/kernel/model/render.go@@ -217,6 +217,26 @@ func resolveEmbedR(n *ast.Node, blockEmbedMode int, luteEngine *lute.Lute, resolsubTree, _ := LoadTreeByBlockID(sqlBlock.ID)var md stringif "d" == sqlBlock.Type {+ if 0 == blockEmbedMode {+ // 嵌入块中出现了大于等于上方非嵌入块的标题时需要降低嵌入块中的标题级别+ // Improve export of heading levels in embedded blocks https://github.com/siyuan-note/siyuan/issues/12233 https://github.com/siyuan-note/siyuan/issues/12741+ embedTopLevel := 0+ ast.Walk(subTree.Root, func(n *ast.Node, entering bool) ast.WalkStatus {+ if !entering || ast.NodeHeading != n.Type {+ return ast.WalkContinue+ }++ embedTopLevel = n.HeadingLevel+ if parentHeadingLevel >= embedTopLevel {+ n.HeadingLevel += parentHeadingLevel - embedTopLevel + 1+ if 6 < n.HeadingLevel {+ n.HeadingLevel = 6+ }+ }+ return ast.WalkContinue+ })+ }+md, _ = lute.FormatNodeSync(subTree.Root, luteEngine.ParseOptions, luteEngine.RenderOptions)} else if "h" == sqlBlock.Type {h := treenode.GetNodeInTree(subTree, sqlBlock.ID)@@ -225,8 +245,6 @@ func resolveEmbedR(n *ast.Node, blockEmbedMode int, luteEngine *lute.Lute, resolhChildren = append(hChildren, treenode.HeadingChildren(h)...)if 0 == blockEmbedMode {- // 嵌入块中出现了大于等于上方非嵌入块的标题时需要降低嵌入块中的标题级别- // Improve export of heading levels in embedded blocks https://github.com/siyuan-note/siyuan/issues/12233embedTopLevel := 0for _, hChild := range hChildren {if ast.NodeHeading == hChild.Type {