🎨 浏览器剪藏扩展转义 Markdown 标记符 Fix https://github.com/siyuan-note/siyuan/issues/6348

This commit is contained in:
Liang Ding 2022-10-25 20:17:22 +08:00
parent 2f54fc0b8a
commit 92e4df2483
No known key found for this signature in database
GPG key ID: 136F30F901A2231D
4 changed files with 7 additions and 13 deletions

View file

@ -68,15 +68,7 @@ func extensionCopy(c *gin.Context) {
return ast.WalkContinue
}
// 浏览器剪藏扩展改进 https://github.com/siyuan-note/siyuan/issues/6124
if ast.NodeInlineMath == n.Type {
// $ 转义
text := &ast.Node{Type: ast.NodeText}
text.Tokens = []byte("\\$" + string(n.ChildByType(ast.NodeInlineMathContent).Tokens) + "\\$")
n.InsertBefore(text)
unlinks = append(unlinks, n)
return ast.WalkSkipChildren
} else if ast.NodeText == n.Type {
if ast.NodeText == n.Type {
// 剔除行首空白
if ast.NodeParagraph == n.Parent.Type && n.Parent.FirstChild == n {
n.Tokens = bytes.TrimLeft(n.Tokens, " \t\n")