🎨 导入 Markdown 时不自动转换超链接 Fix https://github.com/siyuan-note/siyuan/issues/7682

This commit is contained in:
Liang Ding 2023-03-16 10:08:11 +08:00
parent cb85bb8080
commit 7ddf99dab8
No known key found for this signature in database
GPG key ID: 136F30F901A2231D
2 changed files with 18 additions and 17 deletions

View file

@ -38,6 +38,7 @@ 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"
@ -705,6 +706,23 @@ func ImportFromLocalPath(boxID, localPath string, toPath string) (err error) {
return
}
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)
ret = parse.Parse("", markdown, luteEngine.ParseOptions)
genTreeID(ret)
return
}
func processBase64Img(n *ast.Node, dest string, assetDirPath string, err error) {
base64TmpDir := filepath.Join(util.TempDir, "base64")
os.MkdirAll(base64TmpDir, 0755)