Skip to content

Commit

Permalink
🐛 Protyle Inline code pasting issue siyuan-note/siyuan#12999
Browse files Browse the repository at this point in the history
  • Loading branch information
88250 committed Nov 2, 2024
1 parent 71876fb commit a088075
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 2 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.

4 changes: 4 additions & 0 deletions parse/code_span.go
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,10 @@ func (t *Tree) parseCodeSpan(block *ast.Node, ctx *InlineContext) (ret *ast.Node
content.Write(html.EscapeHTML(n.Tokens))
} else if ast.NodeInlineMathContent == n.Type {
content.Write(n.Tokens)
} else if ast.NodeCodeSpanContent == n.Type {
content.WriteByte(lex.ItemBacktick)
content.Write(n.Tokens)
content.WriteByte(lex.ItemBacktick)
}
return ast.WalkContinue
})
Expand Down
1 change: 1 addition & 0 deletions test/m2p_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ import (

var md2BlockDOMTests = []parseTest{

{"93", "foo `` `bar` `` 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=\"code\">\u200b`bar`</span>\u200b baz</div><div class=\"protyle-attr\" contenteditable=\"false\">\u200b</div></div>"},
{"92", "`$ foo $`", "<div data-node-id=\"20060102150405-1a2b3c4\" data-node-index=\"1\" data-type=\"NodeParagraph\" class=\"p\" updated=\"20060102150405\"><div contenteditable=\"true\" spellcheck=\"false\">\u200b<span data-type=\"code\">\u200b$ foo $</span>\u200b</div><div class=\"protyle-attr\" contenteditable=\"false\">\u200b</div></div>"},
{"91", "| foo |\n|---|\n| bar <br> baz |\n", "<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 /></colgroup><thead><tr><th>foo</th></tr></thead><tbody><tr><td>bar <br /> baz</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>"},
{"90", "| foo |\n|---|\n| bar <br /> baz |\n", "<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 /></colgroup><thead><tr><th>foo</th></tr></thead><tbody><tr><td>bar <br /> baz</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>"},
Expand Down

0 comments on commit a088075

Please sign in to comment.