Skip to content

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

:bug: https://github.com/siyuan-note/siyuan/issues/16042

Daniel60c49dbfe9a7
diff --git a/kernel/model/export.go b/kernel/model/export.go
index d5e2f87c12..6fa0c2a0db 100644
--- a/kernel/model/export.go
+++ b/kernel/model/export.go
@@ -2162,9 +2162,11 @@ func exportMarkdownContent0(id string, tree *parse.Tree, cloudAssetsBase string,
href = "#" + defID
}
}
- href = strings.TrimPrefix(href, currentDocDir)
+ newHref := strings.TrimPrefix(href, currentDocDir)
+ if !strings.HasPrefix(newHref, ".md") {
+ href = newHref
+ }
href = util.FilterFilePath(href)
- href = strings.TrimPrefix(href, "/")
blockRefLink := &ast.Node{Type: ast.NodeTextMark, TextMarkType: "a", TextMarkTextContent: linkText, TextMarkAHref: href}
blockRefLink.KramdownIAL = n.KramdownIAL
n.InsertBefore(blockRefLink)