Skip to content

Commit

Permalink
🎨 Improve Protyle inline elements ial parent-style parsing
Browse files Browse the repository at this point in the history
  • Loading branch information
88250 committed Nov 6, 2024
1 parent a4e60c7 commit 1c970cf
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 3 deletions.
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.

2 changes: 1 addition & 1 deletion parse/inline_html.go
Original file line number Diff line number Diff line change
Expand Up @@ -606,7 +606,7 @@ func SetSpanIAL(node *ast.Node, n *html.Node) {
}
}

if nil != n.Parent && nil != n.Parent.Parent {
if nil != n.Parent && nil != n.Parent.Parent && atom.Img == n.DataAtom {
if parentStyle := util.DomAttrValue(n.Parent.Parent, "style"); "" != parentStyle {
if insertedIAL {
m := Tokens2IAL(node.Next.Tokens)
Expand Down
1 change: 1 addition & 0 deletions test/spin_block_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ import (

var spinBlockDOMTests = []*parseTest{

{"234", "<div data-node-id=\"20241106095909-yx1lagp\" data-type=\"NodeParagraph\" class=\"p\" updated=\"20241106100003\" style=\"background-color: var(--b3-card-info-background); color: var(--b3-card-info-color);\"><div contenteditable=\"true\" spellcheck=\"false\">foo <span data-type=\"strong\">bar</span> baz <wbr></div><div class=\"protyle-attr\" contenteditable=\"false\">​</div></div>", "<div data-node-id=\"20241106095909-yx1lagp\" data-node-index=\"1\" data-type=\"NodeParagraph\" class=\"p\" style=\"background-color: var(--b3-card-info-background); color: var(--b3-card-info-color);\" updated=\"20241106100003\"><div contenteditable=\"true\" spellcheck=\"false\">foo <span data-type=\"strong\">bar</span> baz <wbr></div><div class=\"protyle-attr\" contenteditable=\"false\">\u200b</div></div>"},
{"233", "<div data-node-id=\"20241106092017-k5ghamq\" data-node-index=\"1\" data-type=\"NodeParagraph\" class=\"p\" updated=\"20241106092032\"><div contenteditable=\"true\" spellcheck=\"false\">$$<wbr><span data-type=\"inline-math\" data-subtype=\"math\" data-content=\"foo\" contenteditable=\"false\" class=\"render-node\" data-render=\"true\"><span class=\"katex\"><span class=\"katex-html\" aria-hidden=\"true\"><span class=\"base\"><span class=\"strut\" style=\"height:0.8889em;vertical-align:-0.1944em;\"></span><span class=\"mord mathnormal\" style=\"margin-right:0.10764em;\">f</span><span class=\"mord mathnormal\">oo</span></span></span></span></span>\n</div><div class=\"protyle-attr\" contenteditable=\"false\">​</div></div>", "<div data-node-id=\"20241106092017-k5ghamq\" data-node-index=\"1\" data-type=\"NodeMathBlock\" class=\"render-node\" updated=\"20241106092032\" data-content=\"foo\" data-subtype=\"math\"><div spin=\"1\"></div><div class=\"protyle-attr\" contenteditable=\"false\">\u200b</div></div>"},
{"232", "<div data-node-id=\"20241104224414-zw2bqmr\" data-type=\"NodeParagraph\" class=\"p\" updated=\"20241104224424\"><div contenteditable=\"true\" spellcheck=\"false\">[<wbr><span data-type=\"strong\">foo</span></div><div class=\"protyle-attr\" contenteditable=\"false\">​</div></div>", "<div data-node-id=\"20241104224414-zw2bqmr\" data-node-index=\"1\" data-type=\"NodeParagraph\" class=\"p\" updated=\"20241104224424\"><div contenteditable=\"true\" spellcheck=\"false\">[<wbr><span data-type=\"strong\">foo</span></div><div class=\"protyle-attr\" contenteditable=\"false\">\u200b</div></div>"},
{"231", "<div data-node-id=\"20241103085149-shu8xzh\" data-node-index=\"1\" data-type=\"NodeParagraph\" class=\"p\" updated=\"20241103085157\"><div contenteditable=\"true\" spellcheck=\"false\">:\n1<wbr></div><div class=\"protyle-attr\" contenteditable=\"false\">​</div></div>", "<div data-node-id=\"20241103085149-shu8xzh\" data-node-index=\"1\" data-type=\"NodeParagraph\" class=\"p\" updated=\"20241103085157\"><div contenteditable=\"true\" spellcheck=\"false\">:\n1<wbr></div><div class=\"protyle-attr\" contenteditable=\"false\">\u200b</div></div>"},
Expand Down

0 comments on commit 1c970cf

Please sign in to comment.