Skip to content

Commit 755943d

Browse files
authored
Merge pull request #4 from CatcheSearch/dev
Fix html parsing
2 parents 61636d8 + 06858a2 commit 755943d

File tree

5 files changed

+11
-9
lines changed

5 files changed

+11
-9
lines changed

dist/index.js

Lines changed: 3 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/vendor.js

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/components/SearchMenu.vue

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010

1111
<script lang="ts">
1212
import { defineComponent } from 'vue'
13+
import { escapeHtml } from "@vue/shared"
1314
import Minisearch, { SearchResult } from 'minisearch'
1415
import { initSearch, highlightMatch } from '../utils/search'
1516
import SearchBox from './SearchBox.vue'
@@ -108,8 +109,8 @@ export default defineComponent({
108109
.map((result:SearchResult) => {
109110
return {
110111
url: result.url || '',
111-
title: highlightMatch(this.query, result.title).highlight || '',
112-
text: highlightMatch(this.query, result.text, 3, 10).highlight || '',
112+
title: highlightMatch(this.query, escapeHtml(result.title)).highlight || '',
113+
text: highlightMatch(this.query, escapeHtml(result.text), 3, 10).highlight || '',
113114
}
114115
})
115116
this.updateDebounce(performance.now() - startSearchTime)

0 commit comments

Comments
 (0)