🎨 The browser extension supports CSDN formula https://github.com/siyuan-note/siyuan/issues/5624

This commit is contained in:
Daniel 2024-05-21 00:04:56 +08:00
parent dfc8d39a68
commit d3754bd630
No known key found for this signature in database
GPG key ID: 86211BA83DF03017
5 changed files with 34 additions and 9 deletions

View file

@ -121,10 +121,12 @@ func extensionCopy(c *gin.Context) {
uploaded[oName] = "assets/" + fName
}
luteEngine := util.NewStdLute()
md, _ := model.HTML2Markdown(dom)
md, withMath, _ := model.HTML2Markdown(dom)
md = strings.TrimSpace(md)
luteEngine := util.NewStdLute()
if withMath {
luteEngine.SetInlineMath(true)
}
var unlinks []*ast.Node
tree := parse.Parse("", []byte(md), luteEngine.ParseOptions)
ast.Walk(tree.Root, func(n *ast.Node, entering bool) ast.WalkStatus {
@ -153,7 +155,8 @@ func extensionCopy(c *gin.Context) {
md, _ = lute.FormatNodeSync(tree.Root, luteEngine.ParseOptions, luteEngine.RenderOptions)
ret.Data = map[string]interface{}{
"md": md,
"md": md,
"withMath": withMath,
}
ret.Msg = model.Conf.Language(72)
}