diff --git a/.changeset/kind-drinks-joke.md b/.changeset/kind-drinks-joke.md deleted file mode 100644 index b235f5556805..000000000000 --- a/.changeset/kind-drinks-joke.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -'@rocket.chat/meteor': patch ---- - -Fixed issue with asterisk-wrapped text not becoming bold when user enters profile custom status. diff --git a/apps/meteor/client/components/MarkdownText.tsx b/apps/meteor/client/components/MarkdownText.tsx index 3670bcc7cec0..c9af942f6e1c 100644 --- a/apps/meteor/client/components/MarkdownText.tsx +++ b/apps/meteor/client/components/MarkdownText.tsx @@ -16,21 +16,16 @@ type MarkdownTextParams = { withTruncatedText: boolean; } & ComponentProps; -const walkTokens = (token: marked.Token) => { - const boldPattern = /^\*.*\*$|^\*.*|.*\*$/; - const italicPattern = /^__(?=\S)([\s\S]*?\S)__(?!_)|^_(?=\S)([\s\S]*?\S)_(?!_)/; - if (boldPattern.test(token.raw)) { - token.type = 'strong'; - } else if (italicPattern.test(token.raw)) { - token.type = 'em'; - } -}; - -marked.use({ walkTokens }); const documentRenderer = new marked.Renderer(); const inlineRenderer = new marked.Renderer(); const inlineWithoutBreaks = new marked.Renderer(); +marked.Lexer.rules.gfm = { + ...marked.Lexer.rules.gfm, + strong: /^\*\*(?=\S)([\s\S]*?\S)\*\*(?!\*)|^\*(?=\S)([\s\S]*?\S)\*(?!\*)/, + em: /^__(?=\S)([\s\S]*?\S)__(?!_)|^_(?=\S)([\s\S]*?\S)_(?!_)/, +}; + const linkMarked = (href: string | null, _title: string | null, text: string): string => `${text} `; const paragraphMarked = (text: string): string => text; @@ -117,6 +112,7 @@ const MarkdownText = ({ const markedHtml = /inline/.test(variant) ? marked.parseInline(new Option(content).innerHTML, markedOptions) : marked.parse(new Option(content).innerHTML, markedOptions); + if (parseEmoji) { // We are using the old emoji parser here. This could come // with additional processing use, but is the workaround available right now.