From 2b451eddad75f6cba4e51b40c49f668ebcc662ca Mon Sep 17 00:00:00 2001 From: Liang Ding Date: Fri, 23 Dec 2022 10:57:37 +0800 Subject: [PATCH] =?UTF-8?q?:bug:=20=E5=AF=BC=E5=85=A5=20Markdown=20?= =?UTF-8?q?=E6=97=B6=E8=BD=AC=E6=8D=A2=20Base64=20=E5=9B=BE=E7=89=87?= =?UTF-8?q?=E5=A4=B1=E6=95=88=20Fix=20https://github.com/siyuan-note/siyua?= =?UTF-8?q?n/issues/6909?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- kernel/model/box.go | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/kernel/model/box.go b/kernel/model/box.go index abe7251a0..5c96c97aa 100644 --- a/kernel/model/box.go +++ b/kernel/model/box.go @@ -452,7 +452,6 @@ func moveTree(tree *parse.Tree) { func parseStdMd(markdown []byte) (ret *parse.Tree) { luteEngine := lute.New() - luteEngine.SetProtyleWYSIWYG(true) luteEngine.SetFootnotes(false) luteEngine.SetToC(false) luteEngine.SetIndentCodeBlock(false) @@ -510,6 +509,14 @@ func genTreeID(tree *parse.Tree) { if "" == n.ID && 0 < len(n.KramdownIAL) && ast.NodeDocument != n.Type { n.ID = n.IALAttr("id") } + + if ast.NodeParagraph == n.Type && nil != n.FirstChild && ast.NodeTaskListItemMarker == n.FirstChild.Type { + // 踢掉任务列表的第一个子节点左侧空格 + n.FirstChild.Next.Tokens = bytes.TrimLeft(n.FirstChild.Next.Tokens, " ") + // 调整 li.p.tlim 为 li.tlim.p + n.InsertBefore(n.FirstChild) + } + return ast.WalkContinue }) tree.Root.KramdownIAL = parse.Tokens2IAL(tree.Root.LastChild.Tokens)