Skip to content

Commit

Permalink
🎨 Improve HTML clipping siyuan-note/siyuan#12973
Browse files Browse the repository at this point in the history
  • Loading branch information
88250 committed Oct 30, 2024
1 parent 435765a commit 3c5ecdd
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
10 changes: 8 additions & 2 deletions h2m.go
Original file line number Diff line number Diff line change
Expand Up @@ -1231,8 +1231,12 @@ func (lute *Lute) genASTByDOM(n *html.Node, tree *parse.Tree) {
node.Type = ast.NodeParagraph
tree.Context.Tip.AppendChild(node)
tree.Context.Tip = node
case atom.Figure:
case atom.Figure, atom.Picture:
node.Type = ast.NodeParagraph
if !tree.Context.Tip.IsContainerBlock() {
break
}

tree.Context.Tip.AppendChild(node)
tree.Context.Tip = node
defer tree.Context.ParentTip()
Expand Down Expand Up @@ -1335,7 +1339,9 @@ func appendMathBlock(tree *parse.Tree, tex string) {

if ast.NodeParagraph == tree.Context.Tip.Type {
tree.Context.Tip.InsertAfter(mathBlock)
tree.Context.Tip.Unlink()
if nil == tree.Context.Tip.FirstChild {
tree.Context.Tip.Unlink()
}
} else {
tree.Context.Tip.AppendChild(mathBlock)
}
Expand Down
Loading

0 comments on commit 3c5ecdd

Please sign in to comment.