From f1572520d4c28bf0f7429c5671741046df768d37 Mon Sep 17 00:00:00 2001 From: Liang Ding Date: Wed, 17 Aug 2022 17:33:18 +0800 Subject: [PATCH] =?UTF-8?q?:bug:=20=E7=A9=BA=E5=88=97=E8=A1=A8=E4=B8=AD?= =?UTF-8?q?=E6=8F=92=E5=85=A5=E4=BB=BB=E5=8A=A1=E5=88=97=E8=A1=A8=E9=9D=A2?= =?UTF-8?q?=E5=8C=85=E5=B1=91=E6=98=BE=E7=A4=BA=E9=97=AE=E9=A2=98=20Fix=20?= =?UTF-8?q?https://github.com/siyuan-note/siyuan/issues/5665?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- kernel/model/blockinfo.go | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/kernel/model/blockinfo.go b/kernel/model/blockinfo.go index 48db32810..25e90bbfd 100644 --- a/kernel/model/blockinfo.go +++ b/kernel/model/blockinfo.go @@ -194,6 +194,10 @@ func buildBlockBreadcrumb(node *ast.Node) (ret []*BlockPath) { continue } id := parent.ID + fc := parent.FirstChild + if nil != fc && ast.NodeTaskListItemMarker == fc.Type { + fc = fc.Next + } name := html.EscapeHTMLStr(parent.IALAttr("name")) if ast.NodeDocument == parent.Type { @@ -201,7 +205,7 @@ func buildBlockBreadcrumb(node *ast.Node) (ret []*BlockPath) { } else { if "" == name { if ast.NodeListItem == parent.Type { - name = gulu.Str.SubStr(renderBlockText(parent.FirstChild), maxNameLen) + name = gulu.Str.SubStr(renderBlockText(fc), maxNameLen) } else { name = gulu.Str.SubStr(renderBlockText(parent), maxNameLen) } @@ -215,12 +219,12 @@ func buildBlockBreadcrumb(node *ast.Node) (ret []*BlockPath) { if ast.NodeList == parent.Type || ast.NodeSuperBlock == parent.Type || ast.NodeBlockquote == parent.Type { add = false } - if ast.NodeParagraph == parent.Type && nil != parent.Parent && ast.NodeListItem == parent.Parent.Type && nil == parent.Next && nil == parent.Previous { + if ast.NodeParagraph == parent.Type && nil != parent.Parent && ast.NodeListItem == parent.Parent.Type && nil == parent.Next && (nil == parent.Previous || ast.NodeTaskListItemMarker == parent.Previous.Type) { add = false } if ast.NodeListItem == parent.Type { if "" == name { - name = gulu.Str.SubStr(renderBlockText(parent.FirstChild), maxNameLen) + name = gulu.Str.SubStr(renderBlockText(fc), maxNameLen) } }