An open-source, privacy-first, self-hosted knowledge workspace where humans and AI agents work together 开源、隐私优先、自托管的知识工作空间,让人与智能体在此协作
TypeScript agentic-aiai-agentknowledge-baselocal-firstmarkdownmcpmindmapnote-takingself-hostedsiyuanworkspace
:art: Improve exporting markdown block ref relative path https://github.com/siyuan-note/siyuan/issues/16042
Daniel3b914cc9d384
diff --git a/kernel/model/export.go b/kernel/model/export.goindex 6fa0c2a0db..3240a2560e 100644--- a/kernel/model/export.go+++ b/kernel/model/export.go@@ -2162,11 +2162,19 @@ func exportMarkdownContent0(id string, tree *parse.Tree, cloudAssetsBase string,href = "#" + defID}}- newHref := strings.TrimPrefix(href, currentDocDir)- if !strings.HasPrefix(newHref, ".md") {- href = newHref- }++ sameDir := path.Dir(href) == currentDocDirhref = util.FilterFilePath(href)+ if !sameDir {+ var relErr error+ href, relErr = filepath.Rel(currentDocDir, href)+ if nil != relErr {+ logging.LogWarnf("get relative path from [%s] to [%s] failed: %s", currentDocDir, href, relErr)+ }+ href = filepath.ToSlash(href)+ } else {+ href = strings.TrimPrefix(href, currentDocDir+"/")+ }blockRefLink := &ast.Node{Type: ast.NodeTextMark, TextMarkType: "a", TextMarkTextContent: linkText, TextMarkAHref: href}blockRefLink.KramdownIAL = n.KramdownIALn.InsertBefore(blockRefLink)