#58 - index other files than .md
Also, reverted 66e1d2d334 to only make showContext reactive
This commit is contained in:
13
src/utils.ts
13
src/utils.ts
@@ -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]
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user