Skip to content

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

:art: Improve preview style https://github.com/siyuan-note/siyuan/issues/13451

Daniel9752d1cdf7a3
diff --git a/kernel/model/export.go b/kernel/model/export.go
index c9b7f6ac3b..a55bde8ff6 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