Skip to content

Commit

Permalink
update: fix mismatch search content
Browse files Browse the repository at this point in the history
  • Loading branch information
Koooooo-7 committed Sep 19, 2024
1 parent ca5859a commit 09cf221
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions src/plugins/search/search.js
Original file line number Diff line number Diff line change
Expand Up @@ -230,8 +230,8 @@ export function search(query) {
start = indexContent < 11 ? 0 : indexContent - 10;
end = start === 0 ? 100 : indexContent + keyword.length + 90;

if (postContent && end > postContent.length) {
end = postContent.length;
if (handlePostContent && end > handlePostContent.length) {
end = handlePostContent.length;
}

const matchContent =
Expand Down
2 changes: 1 addition & 1 deletion test/e2e/search.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -254,7 +254,7 @@ console.log('Hello World');
await searchFieldElm.fill('searchHere');
// there is a newline after searchHere and the markdown part ```js ``` it should be removed
expect(await resultsHeadingElm.textContent()).toContain(
"...searchHere\nconsole.log('Hello Worl...",
"...searchHere\nconsole.log('Hello World');...",
);
});

Expand Down

0 comments on commit 09cf221

Please sign in to comment.