mirror of
https://github.com/siyuan-note/siyuan.git
synced 2025-12-16 22:50:13 +01:00
🎨 导入 Markdown 时支持图片路径包含空格 Fix https://github.com/siyuan-note/siyuan/issues/6688
This commit is contained in:
parent
70e144d72a
commit
bf0b9df04f
2 changed files with 12 additions and 2 deletions
|
|
@ -450,6 +450,7 @@ func parseStdMd(markdown []byte) (ret *parse.Tree) {
|
|||
luteEngine.SetSetext(false)
|
||||
luteEngine.SetYamlFrontMatter(false)
|
||||
luteEngine.SetLinkRef(false)
|
||||
luteEngine.SetImgPathAllowSpace(true)
|
||||
ret = parse.Parse("", markdown, luteEngine.ParseOptions)
|
||||
genTreeID(ret)
|
||||
return
|
||||
|
|
|
|||
|
|
@ -518,7 +518,14 @@ func ImportFromLocalPath(boxID, localPath string, toPath string) (err error) {
|
|||
return ast.WalkContinue
|
||||
}
|
||||
|
||||
if !util.IsRelativePath(dest) || "" == dest {
|
||||
dest = strings.ReplaceAll(dest, "%20", " ")
|
||||
dest = strings.ReplaceAll(dest, "%5C", "/")
|
||||
n.Tokens = []byte(dest)
|
||||
if !util.IsRelativePath(dest) {
|
||||
return ast.WalkContinue
|
||||
}
|
||||
dest = filepath.ToSlash(dest)
|
||||
if "" == dest {
|
||||
return ast.WalkContinue
|
||||
}
|
||||
|
||||
|
|
@ -611,10 +618,12 @@ func ImportFromLocalPath(boxID, localPath string, toPath string) (err error) {
|
|||
return ast.WalkContinue
|
||||
}
|
||||
|
||||
dest = strings.ReplaceAll(dest, "%20", " ")
|
||||
dest = strings.ReplaceAll(dest, "%5C", "/")
|
||||
n.Tokens = []byte(dest)
|
||||
if !util.IsRelativePath(dest) {
|
||||
return ast.WalkContinue
|
||||
}
|
||||
|
||||
dest = filepath.ToSlash(dest)
|
||||
if "" == dest {
|
||||
return ast.WalkContinue
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue