From 4664438bd4a173ca982deb1236aa47a48394cd51 Mon Sep 17 00:00:00 2001 From: Claudio Wunder Date: Tue, 16 Jan 2024 22:30:01 +0100 Subject: [PATCH] hotfix: keep markdown headings --- util/stringUtils.ts | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/util/stringUtils.ts b/util/stringUtils.ts index c31cc08a8e787..73d825e053c44 100644 --- a/util/stringUtils.ts +++ b/util/stringUtils.ts @@ -1,6 +1,7 @@ export const getAcronymFromString = (str: string) => [...(str.trim().match(/\b(\w)/g) || '')].join('').toUpperCase(); +// Note: We don't remove Markdown Headers delimiters as they're useful for delimiting sections export const parseRichTextIntoPlainText = (richText: string) => richText // replaces JSX and HTML and their properties with an empty string @@ -10,8 +11,6 @@ export const parseRichTextIntoPlainText = (richText: string) => .replace(/\[([^\]]+)\]\([^)]+\)/gm, '$1') // replaces Markdown lists with their content .replace(/^[*-] (.*)$/gm, '$1') - // replaces Markdown headings with their content - .replace(/^#+ (.*)$/gm, '$1') // replaces Markdown underscore, bold and italic with their content .replace(/[_*]{1,2}(.*)[_*]{1,2}/gm, '$1') // replaces Markdown multiline codeblocks with their content