Skip to content

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

:art: `/模板` 搜索按名称自然升序排序 Fix https://github.com/siyuan-note/siyuan/issues/5916

Liang Ding7eafbf017131
diff --git a/kernel/model/template.go b/kernel/model/template.go
index bfcec35637..c30e094bd4 100644
--- a/kernel/model/template.go
+++ b/kernel/model/template.go
@@ -23,6 +23,7 @@ import (
"io/fs"
"os"
"path/filepath"
+ "sort"
"strings"
"text/template"
"time"
@@ -88,6 +89,7 @@ func SearchTemplate(keyword string) (ret []*Block) {
}
return nil
})
+ sort.Slice(ret, func(i, j int) bool { return util.PinYinCompare(filepath.Base(ret[i].Path), filepath.Base(ret[j].Path)) })
return
}