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 3c5ecdd commit 71876fb
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 4 deletions.
4 changes: 2 additions & 2 deletions h2m.go
Original file line number Diff line number Diff line change
Expand Up @@ -276,7 +276,7 @@ func (lute *Lute) genASTByDOM(n *html.Node, tree *parse.Tree) {

if "" == strings.TrimSpace(util.DomText(n)) {
for { // 这里用 for 是为了简化实现
if util.DomExistChildByType(n, atom.Img, atom.Picture, atom.Annotation) {
if util.DomExistChildByType(n, atom.Img, atom.Picture, atom.Annotation, atom.Iframe, atom.Video, atom.Audio, atom.Source, atom.Canvas, atom.Svg, atom.Math) {
break
}

Expand Down Expand Up @@ -1232,11 +1232,11 @@ func (lute *Lute) genASTByDOM(n *html.Node, tree *parse.Tree) {
tree.Context.Tip.AppendChild(node)
tree.Context.Tip = node
case atom.Figure, atom.Picture:
node.Type = ast.NodeParagraph
if !tree.Context.Tip.IsContainerBlock() {
break
}

node.Type = ast.NodeParagraph
tree.Context.Tip.AppendChild(node)
tree.Context.Tip = node
defer tree.Context.ParentTip()
Expand Down
2 changes: 1 addition & 1 deletion javascript/lute.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion javascript/lute.min.js.map

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions test/h2m_test.go

Large diffs are not rendered by default.

0 comments on commit 71876fb

Please sign in to comment.