Skip to content

Commit

Permalink
hotfix: keep markdown headings
Browse files Browse the repository at this point in the history
  • Loading branch information
ovflowd committed Jan 16, 2024
1 parent 791f6ed commit 4664438
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions util/stringUtils.ts
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -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
Expand Down

0 comments on commit 4664438

Please sign in to comment.