mirror of
https://github.com/siyuan-note/siyuan.git
synced 2025-05-17 01:21:14 +08:00
Merge remote-tracking branch 'origin/dev' into dev
This commit is contained in:
commit
cf4be3d8b1
@ -38,7 +38,6 @@ import (
|
|||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/88250/gulu"
|
"github.com/88250/gulu"
|
||||||
"github.com/88250/lute"
|
|
||||||
"github.com/88250/lute/ast"
|
"github.com/88250/lute/ast"
|
||||||
"github.com/88250/lute/html"
|
"github.com/88250/lute/html"
|
||||||
"github.com/88250/lute/html/atom"
|
"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) {
|
func parseStdMd(markdown []byte) (ret *parse.Tree) {
|
||||||
luteEngine := lute.New()
|
luteEngine := util.NewStdLute()
|
||||||
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)
|
|
||||||
ret = parse.Parse("", markdown, luteEngine.ParseOptions)
|
ret = parse.Parse("", markdown, luteEngine.ParseOptions)
|
||||||
if nil == ret {
|
if nil == ret {
|
||||||
return
|
return
|
||||||
|
@ -46,3 +46,19 @@ func NewLute() (ret *lute.Lute) {
|
|||||||
ret.SetSanitize(true)
|
ret.SetSanitize(true)
|
||||||
return
|
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…
Reference in New Issue
Block a user