Skip to content

Commit

Permalink
🎨 Improve HTML kbd clipping siyuan-note/siyuan#12027
Browse files Browse the repository at this point in the history
  • Loading branch information
88250 committed Jul 28, 2024
1 parent ac4be43 commit 062dc15
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 2 deletions.
11 changes: 11 additions & 0 deletions h2m.go
Original file line number Diff line number Diff line change
Expand Up @@ -1030,6 +1030,17 @@ func (lute *Lute) genASTByDOM(n *html.Node, tree *parse.Tree) {
}
return
}
case atom.Kbd:
if nil != tree.Context.Tip.LastChild && ast.NodeKbd == tree.Context.Tip.LastChild.Type {
tree.Context.Tip.AppendChild(&ast.Node{Type: ast.NodeText, Tokens: util.StrToBytes(editor.Zwsp)})
}

kbd := &ast.Node{Type: ast.NodeKbd}
kbd.AppendChild(&ast.Node{Type: ast.NodeKbdOpenMarker})
kbd.AppendChild(&ast.Node{Type: ast.NodeText, Tokens: util.StrToBytes(util.DomText(n))})
kbd.AppendChild(&ast.Node{Type: ast.NodeKbdCloseMarker})
tree.Context.Tip.AppendChild(kbd)
return
case atom.Font:
node.Type = ast.NodeText
tokens := []byte(util.DomText(n))
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 062dc15

Please sign in to comment.