We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent b7a27d2 commit 2c382a5Copy full SHA for 2c382a5
src/renderer/html_handlebars/search.rs
@@ -66,7 +66,13 @@ pub fn create_files(
66
if search_config.copy_js {
67
static_files.add_builtin(
68
"searchindex.js",
69
- format!("Object.assign(window.search, {});", index).as_bytes(),
+ // To reduce the size of the generated JSON by preventing all `"` characters to be
70
+ // escaped, we instead surround the string with much less common `'` character.
71
+ format!(
72
+ "window.search = JSON.parse('{}');",
73
+ index.replace("\\", "\\\\").replace("'", "\\'")
74
+ )
75
+ .as_bytes(),
76
);
77
static_files.add_builtin("searcher.js", searcher::JS);
78
static_files.add_builtin("mark.min.js", searcher::MARK_JS);
0 commit comments