Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: search titles containing ignored characters #1395

Merged
merged 11 commits into from
Nov 8, 2020
19 changes: 19 additions & 0 deletions src/plugins/search/component.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 += `<div class="matching-post">
<a href="${post.url}">
<h2>${post.title}</h2>
Expand Down