Fixed #168 - prevent .removeDiacritics() to remove backticks

This commit is contained in:
Simon Cambier
2023-01-10 21:51:20 +01:00
parent 5299389e89
commit dbd92dc71f

View File

@@ -223,7 +223,12 @@ export function removeDiacritics(str: string): string {
if (str === null || str === undefined) { if (str === null || str === undefined) {
return '' return ''
} }
return str.normalize('NFD').replace(/\p{Diacritic}/gu, '') // Keep backticks for code blocks, because otherwise they are removed by the .normalize() function
// https://stackoverflow.com/a/36100275
str = str.replaceAll('`', '[__omnisearch__backtick__]')
str = str.normalize('NFD').replace(/\p{Diacritic}/gu, '')
str = str.replaceAll('[__omnisearch__backtick__]', '`')
return str
} }
export function getCtrlKeyLabel(): 'ctrl' | '⌘' { export function getCtrlKeyLabel(): 'ctrl' | '⌘' {