Performance improvements

This commit is contained in:
Simon Cambier
2022-10-26 07:40:44 +02:00
parent 611ee8d7f4
commit 33e7f8fe25
4 changed files with 13 additions and 10 deletions

View File

@@ -68,6 +68,15 @@ export async function fileToIndexedDocument(
content = removeDiacritics(content)
const metadata = app.metadataCache.getFileCache(file)
// EXCALIDRAW
// Remove the json code
if (metadata?.frontmatter?.['excalidraw-plugin']) {
const comments = metadata.sections?.filter(s => s.type === 'comment') ?? []
for (const { start, end } of comments.map(c => c.position)) {
content = content.substring(0, start.offset-1) + content.substring(end.offset)
}
}
// Look for links that lead to non-existing files,
// and add them to the index.
if (metadata) {