remove code blocks from search results

pull/829/head
Cory LaViska 2022-07-11 09:13:57 -04:00
rodzic ca95822bba
commit 2376f75f1d
1 zmienionych plików z 5 dodań i 1 usunięć

Wyświetl plik

@ -90,7 +90,11 @@ console.log('Generating search index for documentation');
.join(' ');
const members = getMembers(content);
this.add({ id: index, t: title, h: headings, m: members, c: content });
// Remove markdown code fields from search results. This seems to make search results a bit more accurate and
// reduces search.json from ~679 KB to ~455 KB.
const prunedContent = content.replace(/```(.*?)```/gs, '');
this.add({ id: index, t: title, h: headings, m: members, c: prunedContent });
map[index] = { title, url };
});