From e30a5f6dbb61eac54f9d70c1e513333ebd6e651c Mon Sep 17 00:00:00 2001 From: sy-records <52o@qq52o.cn> Date: Tue, 13 Oct 2020 18:30:26 +0800 Subject: [PATCH 1/5] fix: search titles containing ignored characters --- src/plugins/search/component.js | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/src/plugins/search/component.js b/src/plugins/search/component.js index 388de395d..03a8e1e95 100644 --- a/src/plugins/search/component.js +++ b/src/plugins/search/component.js @@ -148,6 +148,25 @@ function doSearch(value) { let html = ''; matchs.forEach(post => { + if (/<!-- {docsify-ignore} -->/g.test(post.title)) { + post.title = post.title.replace('<!-- {docsify-ignore} -->', ''); + } + + if (/{docsify-ignore}/g.test(post.title)) { + post.title = post.title.replace('{docsify-ignore}', ''); + } + + if (/<!-- {docsify-ignore-all} -->/g.test(post.title)) { + post.title = post.title.replace( + '<!-- {docsify-ignore-all} -->', + '' + ); + } + + if (/{docsify-ignore-all}/g.test(post.title)) { + post.title = post.title.replace('{docsify-ignore-all}', ''); + } + html += `