diff --git a/__tests__/ExpensiMark-Markdown-test.js b/__tests__/ExpensiMark-Markdown-test.js index bb1baf1f..3849bd69 100644 --- a/__tests__/ExpensiMark-Markdown-test.js +++ b/__tests__/ExpensiMark-Markdown-test.js @@ -786,6 +786,9 @@ test('Mention user html to markdown', () => { testString = ''; expect(parser.htmlToMarkdown(testString, extras)).toBe('@user@domain.com'); + + testString = ''; + expect(parser.htmlToMarkdown(testString, extras)).toBe('@user@domain.com'); }); test('Mention report html to markdown', () => { @@ -815,6 +818,9 @@ test('Mention report html to markdown', () => { testString = ''; expect(parser.htmlToMarkdown(testString, extras)).toBe('#room-name'); + + testString = ''; + expect(parser.htmlToMarkdown(testString, extras)).toBe('#room-name'); }); describe('Image tag conversion to markdown', () => { diff --git a/lib/ExpensiMark.ts b/lib/ExpensiMark.ts index 311974cb..f33c8b58 100644 --- a/lib/ExpensiMark.ts +++ b/lib/ExpensiMark.ts @@ -647,7 +647,7 @@ export default class ExpensiMark { { name: 'reportMentions', - regex: //gi, + regex: /|><\/mention-report>)/gi, replacement: (extras, _match, g1, _offset, _string) => { const reportToNameMap = extras.reportIDToName; if (!reportToNameMap || !reportToNameMap[g1]) { @@ -660,7 +660,7 @@ export default class ExpensiMark { }, { name: 'userMention', - regex: /(?:)|(?:(.*?)<\/mention-user>)/gi, + regex: /(?:|><\/mention-user>))|(?:(.*?)<\/mention-user>)/gi, replacement: (extras, _match, g1, g2, _offset, _string) => { if (g1) { const accountToNameMap = extras.accountIDToName;