mirror of
https://github.com/siyuan-note/siyuan.git
synced 2025-12-22 17:40:13 +01:00
🎨 导入 Markdown 时不自动转换超链接 Fix https://github.com/siyuan-note/siyuan/issues/7682
This commit is contained in:
parent
cb85bb8080
commit
7ddf99dab8
2 changed files with 18 additions and 17 deletions
|
|
@ -30,7 +30,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/parse"
|
"github.com/88250/lute/parse"
|
||||||
"github.com/dustin/go-humanize"
|
"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) {
|
func parseKTree(kramdown []byte) (ret *parse.Tree) {
|
||||||
luteEngine := NewLute()
|
luteEngine := NewLute()
|
||||||
ret = parse.Parse("", kramdown, luteEngine.ParseOptions)
|
ret = parse.Parse("", kramdown, luteEngine.ParseOptions)
|
||||||
|
|
|
||||||
|
|
@ -38,6 +38,7 @@ 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"
|
||||||
|
|
@ -705,6 +706,23 @@ func ImportFromLocalPath(boxID, localPath string, toPath string) (err error) {
|
||||||
return
|
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) {
|
func processBase64Img(n *ast.Node, dest string, assetDirPath string, err error) {
|
||||||
base64TmpDir := filepath.Join(util.TempDir, "base64")
|
base64TmpDir := filepath.Join(util.TempDir, "base64")
|
||||||
os.MkdirAll(base64TmpDir, 0755)
|
os.MkdirAll(base64TmpDir, 0755)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue