The Node.js® Website

hotfix: keep markdown headings

Changed files
+1 -2
util
+1 -2
util/stringUtils.ts
··· 1 1 export const getAcronymFromString = (str: string) => 2 2 [...(str.trim().match(/\b(\w)/g) || '')].join('').toUpperCase(); 3 3 4 + // Note: We don't remove Markdown Headers delimiters as they're useful for delimiting sections 4 5 export const parseRichTextIntoPlainText = (richText: string) => 5 6 richText 6 7 // replaces JSX and HTML and their properties with an empty string ··· 10 11 .replace(/\[([^\]]+)\]\([^)]+\)/gm, '$1') 11 12 // replaces Markdown lists with their content 12 13 .replace(/^[*-] (.*)$/gm, '$1') 13 - // replaces Markdown headings with their content 14 - .replace(/^#+ (.*)$/gm, '$1') 15 14 // replaces Markdown underscore, bold and italic with their content 16 15 .replace(/[_*]{1,2}(.*)[_*]{1,2}/gm, '$1') 17 16 // replaces Markdown multiline codeblocks with their content