Skip to content

An open-source, privacy-first, self-hosted knowledge workspace where humans and AI agents work together 开源、隐私优先、自托管的知识工作空间,让人与智能体在此协作

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

Liang Ding7ddf99dab8cf
diff --git a/kernel/model/box.go b/kernel/model/box.go
index 639c176511..8f943f549f 100644
--- a/kernel/model/box.go
+++ b/kernel/model/box.go
@@ -30,7 +30,6 @@ import (
"time"
"github.com/88250/gulu"
- "github.com/88250/lute"
"github.com/88250/lute/ast"
"github.com/88250/lute/parse"
"github.com/dustin/go-humanize"
@@ -403,22 +402,6 @@ func (box *Box) moveTrees0(files []*FileInfo) {
}
}
-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.SetImgPathAllowSpace(true)
- ret = parse.Parse("", markdown, luteEngine.ParseOptions)
- genTreeID(ret)
- return
-}
-
func parseKTree(kramdown []byte) (ret *parse.Tree) {
luteEngine := NewLute()
ret = parse.Parse("", kramdown, luteEngine.ParseOptions)
diff --git a/kernel/model/import.go b/kernel/model/import.go
index ad1c4234d8..37b314217c 100644
--- a/kernel/model/import.go
+++ b/kernel/model/import.go
@@ -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)