Skip to content

Commit 29a5355

Browse files
committed
feat: add highlight on search result #6
Signed-off-by: EINDEX <snowstarlbk@gmail.com>
1 parent 51f8639 commit 29a5355

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/pages/logseq/client.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -239,7 +239,7 @@ export default class LogseqClient {
239239
blocks: await Promise.all(
240240
blocks.map(async (block) => {
241241
return {
242-
html: this.format(block['block/content'], graphName, graphPath),
242+
html: this.format(block['block/content'], graphName, graphPath).replaceAll(query, `<mark>${query}</mark>`),
243243
uuid: block['block/uuid'],
244244
page: await this.getPage({
245245
id: block['block/page'],
@@ -289,7 +289,7 @@ export default class LogseqClient {
289289
query: string,
290290
): Promise<LogseqResponseType<LogseqSearchResult | null>> => {
291291
return await this.catchIssues(async () => {
292-
return await this.searchLogseqInternal(query);
292+
return await this.searchLogseqInternal(query.trim());
293293
});
294294
};
295295

0 commit comments

Comments
 (0)