From 9752d1cdf7a39293060a8bf172d4b9fb4a5366c5 Mon Sep 17 00:00:00 2001 From: Daniel <845765@qq.com> Date: Thu, 13 Mar 2025 20:40:16 +0800 Subject: [PATCH] :art: Improve preview style https://github.com/siyuan-note/siyuan/issues/13451 --- kernel/model/export.go | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/kernel/model/export.go b/kernel/model/export.go index c9b7f6ac3..a55bde8ff 100644 --- a/kernel/model/export.go +++ b/kernel/model/export.go @@ -583,6 +583,19 @@ func Preview(id string) (retStdHTML string) { enableLuteInlineSyntax(luteEngine) luteEngine.SetFootnotes(true) addBlockIALNodes(tree, false) + + // 移除超级块的属性列表 https://github.com/siyuan-note/siyuan/issues/13451 + var unlinks []*ast.Node + ast.Walk(tree.Root, func(n *ast.Node, entering bool) ast.WalkStatus { + if entering && ast.NodeKramdownBlockIAL == n.Type && nil != n.Previous && ast.NodeSuperBlock == n.Previous.Type { + unlinks = append(unlinks, n) + } + return ast.WalkContinue + }) + for _, unlink := range unlinks { + unlink.Unlink() + } + md := treenode.FormatNode(tree.Root, luteEngine) tree = parse.Parse("", []byte(md), luteEngine.ParseOptions) // 使用实际主题样式值替换样式变量 Use real theme style value replace var in preview mode https://github.com/siyuan-note/siyuan/issues/11458