🐛 导入 Markdown 时转换 Base64 图片失效 Fix https://github.com/siyuan-note/siyuan/issues/6909

This commit is contained in:
Liang Ding 2022-12-23 10:57:37 +08:00
parent f0c996b752
commit 2b451eddad
No known key found for this signature in database
GPG Key ID: 136F30F901A2231D

View File

@ -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)