-
Notifications
You must be signed in to change notification settings - Fork 132
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix: export link regex for use in edit message #540
Changes from 1 commit
9fa31fc
ec5c6de
127ab03
2e0bc91
1d5e6ac
b8c6e59
7312a08
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,6 +3,8 @@ import Str from './str'; | |
import {MARKDOWN_URL_REGEX, LOOSE_URL_REGEX, URL_REGEX} from './Url'; | ||
import {CONST} from './CONST'; | ||
|
||
const MARKDOWN_LINK_REGEX = `\\[([^\\][]*(?:\\[[^\\][]*][^\\][]*)*)]\\(${MARKDOWN_URL_REGEX}\\)(?![^<]*(<\\/pre>|<\\/code>))`; | ||
neil-marcellini marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
const SLACK_SPAN_NEW_LINE_TAG = '<span class="c-mrkdwn__br" data-stringify-type="paragraph-break" style="box-sizing: inherit; display: block; height: unset;"></span>'; | ||
|
||
export default class ExpensiMark { | ||
|
@@ -106,10 +108,7 @@ export default class ExpensiMark { | |
{ | ||
name: 'link', | ||
process: (textToProcess, replacement) => { | ||
const regex = new RegExp( | ||
`\\[([^\\][]*(?:\\[[^\\][]*][^\\][]*)*)]\\(${MARKDOWN_URL_REGEX}\\)(?![^<]*(<\\/pre>|<\\/code>))`, | ||
'gi', | ||
); | ||
const regex = new RegExp(MARKDOWN_LINK_REGEX, 'gi'); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Here's we're building a regex with the There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @neil-marcellini |
||
return this.modifyTextForUrlLinks(regex, textToProcess, replacement); | ||
neil-marcellini marked this conversation as resolved.
Show resolved
Hide resolved
|
||
}, | ||
|
||
|
@@ -721,3 +720,7 @@ export default class ExpensiMark { | |
return tagStack.length !== 0; | ||
} | ||
} | ||
|
||
export { | ||
MARKDOWN_LINK_REGEX | ||
}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Move this to Url.js
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@aimane-chnaif
I intentionally placed this constant in ExpensiMark.js. This is not the URL regex, is the regex for parsing markdown URL.
Should I still move this regex to Url.js?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Still I suggest Url.js.
There's no non-default exported const or function defined in ExpensiMark.js
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@aimane-chnaif
Moved