Skip to content

Commit e30a5f6

Browse files
committed
fix: search titles containing ignored characters
1 parent ae45b32 commit e30a5f6

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

src/plugins/search/component.js

+19
Original file line numberDiff line numberDiff line change
@@ -148,6 +148,25 @@ function doSearch(value) {
148148

149149
let html = '';
150150
matchs.forEach(post => {
151+
if (/<!-- {docsify-ignore} -->/g.test(post.title)) {
152+
post.title = post.title.replace('<!-- {docsify-ignore} -->', '');
153+
}
154+
155+
if (/{docsify-ignore}/g.test(post.title)) {
156+
post.title = post.title.replace('{docsify-ignore}', '');
157+
}
158+
159+
if (/<!-- {docsify-ignore-all} -->/g.test(post.title)) {
160+
post.title = post.title.replace(
161+
'<!-- {docsify-ignore-all} -->',
162+
''
163+
);
164+
}
165+
166+
if (/{docsify-ignore-all}/g.test(post.title)) {
167+
post.title = post.title.replace('{docsify-ignore-all}', '');
168+
}
169+
151170
html += `<div class="matching-post">
152171
<a href="${post.url}">
153172
<h2>${post.title}</h2>

0 commit comments

Comments
 (0)