Skip to content

Commit

Permalink
🐛 Protyle HTML block parsing siyuan-note/siyuan#11623
Browse files Browse the repository at this point in the history
  • Loading branch information
88250 committed Jun 3, 2024
1 parent fcdd3f3 commit 7b72f65
Show file tree
Hide file tree
Showing 4 changed files with 6 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.

3 changes: 3 additions & 0 deletions parse/html_block.go
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,9 @@ func HtmlBlockContinue(html *ast.Node, context *Context) int {
tokens := context.currentLine
if context.ParseOption.KramdownBlockIAL && simpleCheckIsBlockIAL(tokens) {
// 判断 IAL 打断
if context.Tip.ParentIs(ast.NodeListItem) {
_, tokens = lex.TrimLeft(tokens)
}
if ial := context.parseKramdownBlockIAL(tokens); 0 < len(ial) {
context.Tip.ID = IAL2Map(ial)["id"]
context.Tip.KramdownIAL = ial
Expand Down
2 changes: 1 addition & 1 deletion test/m2p_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ import (

var md2BlockDOMTests = []parseTest{

{"83", "* {: id=\"20240603114014-or9nbyv\" updated=\"20240603114628\"}\n <div>\n foo\n </div>\n {: id=\"20240603114015-u94uyd8\" updated=\"20240603114628\"}\n{: id=\"20240603094127-gzqoee7\" updated=\"20240603114628\"}\n\n{: id=\"20240603114213-a343v4t\" updated=\"20240603114213\"}\n", "<div data-subtype=\"u\" data-node-id=\"20240603094127-gzqoee7\" data-node-index=\"1\" data-type=\"NodeList\" class=\"list\" updated=\"20240603114628\"><div data-marker=\"*\" data-subtype=\"u\" data-node-id=\"20240603114014-or9nbyv\" data-type=\"NodeListItem\" class=\"li\" updated=\"20240603114628\"><div class=\"protyle-action\" draggable=\"true\"><svg><use xlink:href=\"#iconDot\"></use></svg></div><div data-node-id=\"20060102150405-1a2b3c4\" data-type=\"NodeHTMLBlock\" class=\"render-node\" updated=\"20060102150405\" data-subtype=\"block\"><div class=\"protyle-icons\"><span class=\"b3-tooltips__nw b3-tooltips protyle-icon protyle-icon--first protyle-action__edit\"><svg><use xlink:href=\"#iconEdit\"></use></svg></span><span class=\"b3-tooltips__nw b3-tooltips protyle-icon protyle-action__menu protyle-icon--last\"><svg><use xlink:href=\"#iconMore\"></use></svg></span></div><div><protyle-html data-content=\"&lt;div&gt;\nfoo\n&lt;/div&gt;\n{: id=&quot;20240603114015-u94uyd8&quot; updated=&quot;20240603114628&quot;}\"></protyle-html><span style=\"position: absolute\">\u200b</span></div><div class=\"protyle-attr\" contenteditable=\"false\">\u200b</div></div><div class=\"protyle-attr\" contenteditable=\"false\">\u200b</div></div><div class=\"protyle-attr\" contenteditable=\"false\">\u200b</div></div><div data-node-id=\"20240603114213-a343v4t\" data-node-index=\"2\" data-type=\"NodeParagraph\" class=\"p\" updated=\"20240603114213\"><div contenteditable=\"true\" spellcheck=\"false\"></div><div class=\"protyle-attr\" contenteditable=\"false\">\u200b</div></div>"},
{"83", "* {: updated=\"20240603115819\" id=\"20240603115809-7c2x9yn\"}\n <div>\n fooo\n </div>\n {: updated=\"20240603115819\" id=\"20240603115809-2uob5by\"}\n </div>\n{: id=\"20240603115808-cnyfb31\" updated=\"20240603115819\"}", "<div data-subtype=\"u\" data-node-id=\"20240603115808-cnyfb31\" data-node-index=\"1\" data-type=\"NodeList\" class=\"list\" updated=\"20240603115819\"><div data-marker=\"*\" data-subtype=\"u\" data-node-id=\"20240603115809-7c2x9yn\" data-type=\"NodeListItem\" class=\"li\" updated=\"20240603115819\"><div class=\"protyle-action\" draggable=\"true\"><svg><use xlink:href=\"#iconDot\"></use></svg></div><div data-node-id=\"20240603115809-2uob5by\" data-type=\"NodeHTMLBlock\" class=\"render-node\" updated=\"20240603115819\" data-subtype=\"block\"><div class=\"protyle-icons\"><span class=\"b3-tooltips__nw b3-tooltips protyle-icon protyle-icon--first protyle-action__edit\"><svg><use xlink:href=\"#iconEdit\"></use></svg></span><span class=\"b3-tooltips__nw b3-tooltips protyle-icon protyle-action__menu protyle-icon--last\"><svg><use xlink:href=\"#iconMore\"></use></svg></span></div><div><protyle-html data-content=\"&lt;div&gt;\nfooo\n&lt;/div&gt;\"></protyle-html><span style=\"position: absolute\">\u200b</span></div><div class=\"protyle-attr\" contenteditable=\"false\">\u200b</div></div><div data-node-id=\"20060102150405-1a2b3c4\" data-type=\"NodeParagraph\" class=\"p\" updated=\"20060102150405\"><div contenteditable=\"true\" spellcheck=\"false\">&lt;/div&gt;</div><div class=\"protyle-attr\" contenteditable=\"false\">\u200b</div></div><div class=\"protyle-attr\" contenteditable=\"false\">\u200b</div></div><div class=\"protyle-attr\" contenteditable=\"false\">\u200b</div></div>"},
{"82", "|参数|作用|\n| -----------------------| ------------------------------|\n|listen\\=[YES&#124;NO]|是否以独立运行的方式监听服务|", "<div data-node-id=\"20060102150405-1a2b3c4\" data-node-index=\"1\" data-type=\"NodeTable\" class=\"table\" updated=\"20060102150405\"><div contenteditable=\"false\"><table contenteditable=\"true\" spellcheck=\"false\"><colgroup><col /><col /></colgroup><thead><tr><th>参数</th><th>作用</th></tr></thead><tbody><tr><td>listen<span data-type=\"backslash\">=</span>[YES&#124;NO]</td><td>是否以独立运行的方式监听服务</td></tr></tbody></table><div class=\"protyle-action__table\"><div class=\"table__resize\"></div><div class=\"table__select\"></div></div></div><div class=\"protyle-attr\" contenteditable=\"false\">\u200b</div></div>"},
{"81", "[在必应搜索 \"你好\"](www.bing.com/search?q=\"你好\")", "<div data-node-id=\"20060102150405-1a2b3c4\" data-node-index=\"1\" data-type=\"NodeParagraph\" class=\"p\" updated=\"20060102150405\"><div contenteditable=\"true\" spellcheck=\"false\"><span data-type=\"a\" data-href=\"www.bing.com/search?q=&amp;quot;你好&amp;quot;\">在必应搜索 &quot;你好&quot;</span></div><div class=\"protyle-attr\" contenteditable=\"false\">\u200b</div></div>"},
{"80", "foo<u>bar</u>baz", "<div data-node-id=\"20060102150405-1a2b3c4\" data-node-index=\"1\" data-type=\"NodeParagraph\" class=\"p\" updated=\"20060102150405\"><div contenteditable=\"true\" spellcheck=\"false\">foo<span data-type=\"u\">bar</span>baz</div><div class=\"protyle-attr\" contenteditable=\"false\">\u200b</div></div>"},
Expand Down

0 comments on commit 7b72f65

Please sign in to comment.