#58 - index other files than .md

Also, reverted 66e1d2d334 to only make showContext reactive
This commit is contained in:
Simon Cambier
2022-09-23 20:50:55 +02:00
parent 0da61668b0
commit eacb53dc88
9 changed files with 104 additions and 107 deletions

View File

@@ -9,6 +9,7 @@ import {
regexYaml,
} from './globals'
import type { SearchMatch } from './globals'
import { settings } from './settings'
export function highlighter(str: string): string {
return `<span class="${highlightClass}">${str}</span>`
@@ -170,3 +171,15 @@ export function removeDiacritics(str: string): string {
export function getCtrlKeyLabel(): 'ctrl' | '⌘' {
return Platform.isMacOS ? '⌘' : 'ctrl'
}
export function isFileIndexable(path: string): boolean {
return (
path.endsWith('.md') ||
settings.indexedFileTypes.some(t => path.endsWith(`.${t}`))
)
}
export function getExtension(path: string): string {
const split = path.split('.')
return split[split.length - 1]
}