mirror of
https://github.com/docsifyjs/docsify.git
synced 2025-12-08 19:55:52 +00:00
fix: Inconsistent search and body rendering
* fix * Update search.js * Update search.js * Update search.js * Update search.js * Update search.js
This commit is contained in:
parent
39320bb3f4
commit
dcb0aaea99
@ -25,10 +25,9 @@ function escapeHtml(string) {
|
||||
'>': '>',
|
||||
'"': '"',
|
||||
"'": ''',
|
||||
'/': '/',
|
||||
};
|
||||
|
||||
return String(string).replace(/[&<>"'/]/g, s => entityMap[s]);
|
||||
return String(string).replace(/[&<>"']/g, s => entityMap[s]);
|
||||
}
|
||||
|
||||
function getAllPaths(router) {
|
||||
@ -66,7 +65,7 @@ export function genIndex(path, content = '', router, depth) {
|
||||
|
||||
tokens.forEach(token => {
|
||||
if (token.type === 'heading' && token.depth <= depth) {
|
||||
slug = router.toURL(path, { id: slugify(token.text) });
|
||||
slug = router.toURL(path, { id: slugify(escapeHtml(token.text)) });
|
||||
index[slug] = { slug, title: token.text, body: '' };
|
||||
} else {
|
||||
if (!slug) {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user