mirror of
https://github.com/siyuan-note/siyuan.git
synced 2025-12-16 22:50:13 +01:00
🎨 Formula parsing supports $ followed by numbers when importing Markdown https://github.com/siyuan-note/siyuan/issues/8362
This commit is contained in:
parent
debda24c02
commit
a3d2e89a65
2 changed files with 17 additions and 12 deletions
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue