Skip to content

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

:art: Improve bookmark panel rendering https://github.com/siyuan-note/siyuan/issues/9361

Daniel3b9d4b3a7387
diff --git a/kernel/model/bookmark.go b/kernel/model/bookmark.go
index 16d7306cd3..d0e58081c9 100644
--- a/kernel/model/bookmark.go
+++ b/kernel/model/bookmark.go
@@ -23,6 +23,7 @@ import (
"strings"
"github.com/88250/lute/parse"
+ "github.com/siyuan-note/logging"
"github.com/siyuan-note/siyuan/kernel/cache"
"github.com/siyuan-note/siyuan/kernel/sql"
"github.com/siyuan-note/siyuan/kernel/treenode"
@@ -162,16 +163,26 @@ func BuildBookmark() (ret *Bookmarks) {
ret = &Bookmarks{}
sqlBlocks := sql.QueryBookmarkBlocks()
+
labelBlocks := map[BookmarkLabel]BookmarkBlocks{}
blocks := fromSQLBlocks(&sqlBlocks, "", 0)
+ luteEngine := NewLute()
for _, block := range blocks {
- label := BookmarkLabel(block.IAL["bookmark"])
-
if "" != block.Name {
// Blocks in the bookmark panel display their name instead of content https://github.com/siyuan-note/siyuan/issues/8514
block.Content = block.Name
+ } else {
+ // Improve bookmark panel rendering https://github.com/siyuan-note/siyuan/issues/9361
+ tree, err := loadTreeByBlockID(block.ID)
+ if nil != err {
+ logging.LogErrorf("parse block [%s] failed: %s", block.ID, err)
+ } else {
+ n := treenode.GetNodeInTree(tree, block.ID)
+ block.Content = renderOutline(n, luteEngine)
+ }
}
+ label := BookmarkLabel(block.IAL["bookmark"])
if bs, ok := labelBlocks[label]; ok {
bs = append(bs, block)
labelBlocks[label] = bs