🎨 Improve exporting Markdown https://github.com/siyuan-note/siyuan/issues/13273
This commit is contained in:
parent
da1b97f70c
commit
575869c546
1 changed files with 5 additions and 1 deletions
|
@ -1944,6 +1944,8 @@ func exportMarkdownContent0(tree *parse.Tree, cloudAssetsBase string, assetsDest
|
|||
})
|
||||
}
|
||||
|
||||
currentDocDir := path.Dir(tree.HPath)
|
||||
|
||||
var unlinks []*ast.Node
|
||||
ast.Walk(tree.Root, func(n *ast.Node, entering bool) ast.WalkStatus {
|
||||
if !entering {
|
||||
|
@ -1979,12 +1981,14 @@ func exportMarkdownContent0(tree *parse.Tree, cloudAssetsBase string, assetsDest
|
|||
var href string
|
||||
bt := treenode.GetBlockTree(defID)
|
||||
if nil != bt {
|
||||
href += strings.TrimPrefix(bt.HPath, "/") + ".md"
|
||||
href += bt.HPath + ".md"
|
||||
if "d" != bt.Type {
|
||||
href += "#" + defID
|
||||
}
|
||||
}
|
||||
href = strings.TrimPrefix(href, currentDocDir)
|
||||
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)
|
||||
|
|
Loading…
Add table
Reference in a new issue