Skip to content

Commit dcb0aae

Browse files
authored
fix: Inconsistent search and body rendering
* fix * Update search.js * Update search.js * Update search.js * Update search.js * Update search.js
1 parent 39320bb commit dcb0aae

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

src/plugins/search/search.js

+2-3
Original file line numberDiff line numberDiff line change
@@ -25,10 +25,9 @@ function escapeHtml(string) {
2525
'>': '>',
2626
'"': '"',
2727
"'": ''',
28-
'/': '/',
2928
};
3029

31-
return String(string).replace(/[&<>"'/]/g, s => entityMap[s]);
30+
return String(string).replace(/[&<>"']/g, s => entityMap[s]);
3231
}
3332

3433
function getAllPaths(router) {
@@ -66,7 +65,7 @@ export function genIndex(path, content = '', router, depth) {
6665

6766
tokens.forEach(token => {
6867
if (token.type === 'heading' && token.depth <= depth) {
69-
slug = router.toURL(path, { id: slugify(token.text) });
68+
slug = router.toURL(path, { id: slugify(escapeHtml(token.text)) });
7069
index[slug] = { slug, title: token.text, body: '' };
7170
} else {
7271
if (!slug) {

0 commit comments

Comments
 (0)