🎨 Formula parsing supports $ followed by numbers when importing Markdown https://github.com/siyuan-note/siyuan/issues/8362

This commit is contained in:
Daniel 2023-05-25 22:00:56 +08:00
parent debda24c02
commit a3d2e89a65
No known key found for this signature in database
GPG key ID: 86211BA83DF03017
2 changed files with 17 additions and 12 deletions

View file

@ -38,7 +38,6 @@ import (
"time"
"github.com/88250/gulu"
"github.com/88250/lute"
"github.com/88250/lute/ast"
"github.com/88250/lute/html"
"github.com/88250/lute/html/atom"
@ -712,17 +711,7 @@ func ImportFromLocalPath(boxID, localPath string, toPath string) (err error) {
}
func parseStdMd(markdown []byte) (ret *parse.Tree) {
luteEngine := lute.New()
luteEngine.SetFootnotes(false)
luteEngine.SetToC(false)
luteEngine.SetIndentCodeBlock(false)
luteEngine.SetAutoSpace(false)
luteEngine.SetHeadingID(false)
luteEngine.SetSetext(false)
luteEngine.SetYamlFrontMatter(false)
luteEngine.SetLinkRef(false)
luteEngine.SetGFMAutoLink(false) // 导入 Markdown 时不自动转换超链接 https://github.com/siyuan-note/siyuan/issues/7682
luteEngine.SetImgPathAllowSpace(true)
luteEngine := util.NewStdLute()
ret = parse.Parse("", markdown, luteEngine.ParseOptions)
if nil == ret {
return

View file

@ -46,3 +46,19 @@ func NewLute() (ret *lute.Lute) {
ret.SetSanitize(true)
return
}
func NewStdLute() (ret *lute.Lute) {
ret = lute.New()
ret.SetFootnotes(false)
ret.SetToC(false)
ret.SetIndentCodeBlock(false)
ret.SetAutoSpace(false)
ret.SetHeadingID(false)
ret.SetSetext(false)
ret.SetYamlFrontMatter(false)
ret.SetLinkRef(false)
ret.SetGFMAutoLink(false) // 导入 Markdown 时不自动转换超链接 https://github.com/siyuan-note/siyuan/issues/7682
ret.SetImgPathAllowSpace(true)
ret.SetInlineMathAllowDigitAfterOpenMarker(true) // Formula parsing supports $ followed by numbers when importing Markdown https://github.com/siyuan-note/siyuan/issues/8362
return
}