mirror of
https://github.com/mindoc-org/mindoc.git
synced 2025-09-20 02:37:59 +08:00
优化导出Markdown内链路径
This commit is contained in:
@@ -523,6 +523,14 @@ func exportMarkdown(p string, parentId int, bookId int,baseDir string,bookUrl st
|
||||
if !strings.HasSuffix(tempLink,".md") && !strings.HasSuffix(doc.Identify,".markdown") {
|
||||
tempLink = tempLink + ".md"
|
||||
}
|
||||
relative := strings.TrimPrefix(strings.Replace(p,"\\","/",-1),strings.Replace(baseDir,"\\","/",-1))
|
||||
repeat := 0
|
||||
if relative != "" {
|
||||
relative = strings.TrimSuffix(strings.TrimPrefix(relative,"/"),"/")
|
||||
repeat = strings.Count(relative,"/") + 1
|
||||
}
|
||||
beego.Info(repeat,"|",relative,"|",p,"|",baseDir)
|
||||
tempLink = strings.Repeat("../",repeat) + tempLink
|
||||
|
||||
link = strings.TrimSuffix(link, originalLink+")") + tempLink + ")"
|
||||
}
|
||||
|
Reference in New Issue
Block a user