Skip to content

Commit

Permalink
Fix edit to remove link not working
Browse files Browse the repository at this point in the history
  • Loading branch information
eh2077 committed Oct 7, 2023
1 parent 0c2c23d commit 4af018d
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
6 changes: 6 additions & 0 deletions __tests__/ExpensiMark-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
});
2 changes: 1 addition & 1 deletion lib/ExpensiMark.js
Original file line number Diff line number Diff line change
Expand Up @@ -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(`<a href="${MARKDOWN_URL_REGEX}" target="_blank" rel="noreferrer noopener">`, 'gi');
Expand Down

0 comments on commit 4af018d

Please sign in to comment.