🎨 Improve exporting block hyperlink jumping https://github.com/siyuan-note/siyuan/issues/13837

This commit is contained in:
Daniel 2025-01-16 17:23:02 +08:00
parent 2ee69394da
commit 713c55ed7a
No known key found for this signature in database
GPG key ID: 86211BA83DF03017

View file

@ -2068,6 +2068,7 @@ func exportTree(tree *parse.Tree, wysiwyg, keepFold, avHiddenCol bool,
luteEngine := NewLute()
ret = tree
id := tree.Root.ID
(*treeCache)[tree.ID] = tree
// 解析查询嵌入节点
depth := 0
@ -2799,7 +2800,7 @@ func blockLink2Ref(currentTree *parse.Tree, id string, treeCache *map[string]*pa
if nil == b {
return
}
t, err := loadTreeWithCache(b.ID, treeCache)
t, err := loadTreeWithCache(b.RootID, treeCache)
if nil != err {
return
}
@ -2849,7 +2850,7 @@ func collectFootnotesDefs(currentTree *parse.Tree, id string, refFootnotes *[]*r
if nil == b {
return
}
t, err := loadTreeWithCache(b.ID, treeCache)
t, err := loadTreeWithCache(b.RootID, treeCache)
if nil != err {
return
}
@ -3122,12 +3123,12 @@ func prepareExportTrees(docPaths []string) (defBlockIDs []string, trees *map[str
treeCache := &map[string]*parse.Tree{}
defBlockIDs = []string{}
for i, p := range docPaths {
id := strings.TrimSuffix(path.Base(p), ".sy")
if !ast.IsNodeIDPattern(id) {
rootID := strings.TrimSuffix(path.Base(p), ".sy")
if !ast.IsNodeIDPattern(rootID) {
continue
}
tree, err := loadTreeWithCache(id, treeCache)
tree, err := loadTreeWithCache(rootID, treeCache)
if err != nil {
continue
}