From 1642ec53a2dd7160f60bcbb74153de2db475f927 Mon Sep 17 00:00:00 2001 From: Liang Ding Date: Thu, 12 Jan 2023 11:00:24 +0800 Subject: [PATCH] =?UTF-8?q?:bug:=20=E8=B0=83=E7=94=A8=E6=A8=A1=E6=9D=BF?= =?UTF-8?q?=E6=97=B6=E6=A8=A1=E6=9D=BF=E5=90=8D=E9=A6=96=E5=AD=97=E7=AC=A6?= =?UTF-8?q?=E4=B9=B1=E7=A0=81=20Fix=20https://github.com/siyuan-note/siyua?= =?UTF-8?q?n/issues/7049?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- kernel/model/template.go | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/kernel/model/template.go b/kernel/model/template.go index dab07ae1e..5a11cc4d5 100644 --- a/kernel/model/template.go +++ b/kernel/model/template.go @@ -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)