🎨 改进导入 Markdown 时 <img> 标签的处理 Fix https://github.com/siyuan-note/siyuan/issues/5501

This commit is contained in:
Liang Ding 2022-07-24 20:49:13 +08:00
parent a7b43cbd22
commit be2913c956
No known key found for this signature in database
GPG key ID: 136F30F901A2231D
2 changed files with 64 additions and 2 deletions

View file

@ -570,8 +570,7 @@ func buildSpanFromNode(n *ast.Node, tree *parse.Tree, rootID, boxID, p string) (
spans = append(spans, tags...)
}
case ast.NodeInlineHTML, ast.NodeHTMLBlock, ast.NodeIFrame, ast.NodeWidget, ast.NodeAudio, ast.NodeVideo:
htmlRoot := &html.Node{Type: html.ElementNode}
nodes, err := html.ParseFragment(strings.NewReader(gulu.Str.FromBytes(n.Tokens)), htmlRoot)
nodes, err := html.ParseFragment(bytes.NewReader(n.Tokens), &html.Node{Type: html.ElementNode})
if nil != err {
logging.LogErrorf("parse HTML failed: %s", err)
walkStatus = ast.WalkContinue