From 37421e0184dd2bd3eaa68a1c3da9743b409f0703 Mon Sep 17 00:00:00 2001 From: Liang Ding Date: Fri, 11 Nov 2022 21:27:35 +0800 Subject: [PATCH] =?UTF-8?q?:art:=20=E6=96=87=E6=A1=A3=E5=9D=97=E8=BD=AC?= =?UTF-8?q?=E6=8D=A2=E4=B8=BA=E6=A0=87=E9=A2=98=E5=9D=97=E6=97=B6=E5=B0=86?= =?UTF-8?q?=E6=96=87=E6=A1=A3=E6=A0=87=E7=AD=BE=E7=A7=BB=E5=8A=A8=E5=88=B0?= =?UTF-8?q?=E6=A0=87=E9=A2=98=E5=9D=97=E4=B8=8B=E6=96=B9=20Fix=20https://g?= =?UTF-8?q?ithub.com/siyuan-note/siyuan/issues/6550?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- kernel/model/heading.go | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/kernel/model/heading.go b/kernel/model/heading.go index 06ce3ea75..80e95b92f 100644 --- a/kernel/model/heading.go +++ b/kernel/model/heading.go @@ -163,7 +163,7 @@ func Doc2Heading(srcID, targetID string, after bool) (srcTreeBox, srcTreePath st heading.AppendChild(&ast.Node{Type: ast.NodeText, Tokens: []byte(srcTree.Root.IALAttr("title"))}) heading.Box = targetTree.Box heading.Path = targetTree.Path - if 0 < len(tags) { + if "" != tagIAL && 0 < len(tags) { // 带标签的文档块转换为标题块时将标签移动到标题块下方 https://github.com/siyuan-note/siyuan/issues/6550 tagPara := parse.NewParagraph() @@ -177,7 +177,9 @@ func Doc2Heading(srcID, targetID string, after bool) (srcTreeBox, srcTreePath st tagPara.AppendChild(&ast.Node{Type: ast.NodeText, Tokens: []byte(" ")}) } } - srcTree.Root.PrependChild(tagPara) + if nil != tagPara.FirstChild { + srcTree.Root.PrependChild(tagPara) + } } var nodes []*ast.Node