From dbd92dc71f99031962a943e98aec25f198a8327c Mon Sep 17 00:00:00 2001 From: Simon Cambier Date: Tue, 10 Jan 2023 21:51:20 +0100 Subject: [PATCH] Fixed #168 - prevent .removeDiacritics() to remove backticks --- src/tools/utils.ts | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/tools/utils.ts b/src/tools/utils.ts index 65fa036..993a703 100644 --- a/src/tools/utils.ts +++ b/src/tools/utils.ts @@ -223,7 +223,12 @@ export function removeDiacritics(str: string): string { if (str === null || str === undefined) { 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' | '⌘' {