Skip to content

Commit

Permalink
🎨 Improve HTML img clipping siyuan-note/siyuan#11859
Browse files Browse the repository at this point in the history
  • Loading branch information
88250 committed Jun 30, 2024
1 parent 37c5b6d commit 6227cdd
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 6 deletions.
9 changes: 8 additions & 1 deletion h2m.go
Original file line number Diff line number Diff line change
Expand Up @@ -707,7 +707,14 @@ func (lute *Lute) genASTByDOM(n *html.Node, tree *parse.Tree) {
}

node.AppendChild(&ast.Node{Type: ast.NodeLinkDest, Tokens: util.StrToBytes(src)})
linkTitle := util.DomAttrValue(n, "title")
var linkTitle string
if nil != n.NextSibling && atom.Figcaption == n.NextSibling.DataAtom {
linkTitle = util.DomText(n.NextSibling)
n.NextSibling.Unlink()
}
if "" == linkTitle {
linkTitle = util.DomAttrValue(n, "title")
}
if "" != linkTitle {
node.AppendChild(&ast.Node{Type: ast.NodeLinkSpace})
node.AppendChild(&ast.Node{Type: ast.NodeLinkTitle, Tokens: []byte(linkTitle)})
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.

Loading

0 comments on commit 6227cdd

Please sign in to comment.