From 4af018d4ae409111dbf4494af8cea220c6ec4c63 Mon Sep 17 00:00:00 2001 From: Eric Han Date: Sat, 7 Oct 2023 20:22:07 +0800 Subject: [PATCH] Fix edit to remove link not working --- __tests__/ExpensiMark-test.js | 6 ++++++ lib/ExpensiMark.js | 2 +- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/__tests__/ExpensiMark-test.js b/__tests__/ExpensiMark-test.js index 2755c3e2..cad53935 100644 --- a/__tests__/ExpensiMark-test.js +++ b/__tests__/ExpensiMark-test.js @@ -38,3 +38,9 @@ test('Test extract link with ending parentheses', () => { const links = ['https://staging.new.expensify.com/details', 'https://staging.new.expensify.com/details', 'https://staging.new.expensify.com/details']; expect(parser.extractLinksInMarkdownComment(comment)).toStrictEqual(links); }); + +test('Test extract link from Markdown link syntax', () => { + const comment = 'www.google.com https://www.google.com [Expensify](https://new.expensify.com/)'; + const links = ['https://new.expensify.com/']; + expect(parser.extractLinksInMarkdownComment(comment)).toStrictEqual(links); +}); diff --git a/lib/ExpensiMark.js b/lib/ExpensiMark.js index 755859ae..33360bc6 100644 --- a/lib/ExpensiMark.js +++ b/lib/ExpensiMark.js @@ -771,7 +771,7 @@ export default class ExpensiMark { */ extractLinksInMarkdownComment(comment) { try { - const htmlString = this.replace(comment); + const htmlString = this.replace(comment, {filterRules: ['link']}); // We use same anchor tag template as link and autolink rules to extract link const regex = new RegExp(``, 'gi');