🐛 调用模板时模板名首字符乱码 Fix https://github.com/siyuan-note/siyuan/issues/7049

This commit is contained in:
Liang Ding 2023-01-12 11:00:24 +08:00
parent f1b39149fc
commit 1642ec53a2
No known key found for this signature in database
GPG key ID: 136F30F901A2231D

View file

@ -96,7 +96,7 @@ func SearchTemplate(keyword string) (ret []*Block) {
content := strings.TrimPrefix(path, templates)
content = strings.TrimSuffix(content, ".md")
content = filepath.ToSlash(content)
content = content[1:]
content = strings.TrimPrefix(content, "/")
_, content = search.MarkText(content, keyword, 32, Conf.Search.CaseSensitive)
b := &Block{Path: path, Content: content}
templateBlocks = append(templateBlocks, b)
@ -115,7 +115,6 @@ func SearchTemplate(keyword string) (ret []*Block) {
content := group.Name()
content = strings.TrimSuffix(content, ".md")
content = filepath.ToSlash(content)
content = content[1:]
_, content = search.MarkText(content, keyword, 32, Conf.Search.CaseSensitive)
b := &Block{Path: filepath.Join(templates, group.Name()), Content: content}
ret = append(ret, b)