diff --git a/lib/shared/markdown.js b/lib/shared/markdown.js --- a/lib/shared/markdown.js +++ b/lib/shared/markdown.js @@ -234,8 +234,9 @@ hasAccessToChat: boolean, } { const threadInfo = chatMentionCandidates[capture[2]]; - const threadName = threadInfo?.uiName ?? decodeChatMentionText(capture[3]); - const content = `@${threadName}`; + const threadName = + threadInfo?.uiName ?? decodeChatMentionText(capture[3] + capture[4]); + const content = `${capture[0][0] !== '@' ? capture[0][0] : ''}@${threadName}`; return { threadInfo, content, diff --git a/lib/shared/mention-utils.js b/lib/shared/mention-utils.js --- a/lib/shared/mention-utils.js +++ b/lib/shared/mention-utils.js @@ -58,7 +58,7 @@ 'g', ); -const chatMentionRegexString = `(? `@${decodeChatMentionText(match[3])}`, + (...match) => + `${match[0][0] !== '@' ? match[0][0] : ''}@${decodeChatMentionText( + match[3] + match[4], + )}`, ); }