diff --git a/__tests__/ExpensiMark-HTML-test.js b/__tests__/ExpensiMark-HTML-test.js index 49280829..578357e0 100644 --- a/__tests__/ExpensiMark-HTML-test.js +++ b/__tests__/ExpensiMark-HTML-test.js @@ -1122,4 +1122,13 @@ test('Test here mention with @here@here', () => { const testString = '@here@here'; const resultString = '@here@here'; expect(parser.replace(testString)).toBe(resultString); -}); \ No newline at end of file +}); + +test('Test link with code fence inside the alias text part', () => { + const testString = '[```code```](google.com) ' + + '[test ```code``` test](google.com)'; + + const resultString = '[
code
](google.com) ' + + '[test
code
test](google.com)'; + expect(parser.replace(testString)).toBe(resultString); +}); diff --git a/lib/ExpensiMark.js b/lib/ExpensiMark.js index 8d2186f7..33149c00 100644 --- a/lib/ExpensiMark.js +++ b/lib/ExpensiMark.js @@ -457,7 +457,7 @@ export default class ExpensiMark { } replacedText = replacedText.concat(textToCheck.substr(startIndex, (match.index - startIndex))); - if (abort) { + if (abort || match[1].includes('
')) {
                 replacedText = replacedText.concat(textToCheck.substr(match.index, (match[0].length)));
             } else {
                 const urlRegex = new RegExp(`^${LOOSE_URL_REGEX}$|^${URL_REGEX}$`, 'i');