expensify-common 2.0.208 → 2.0.209

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1214,13 +1214,18 @@ class ExpensiMark {
1214
1214
  },
1215
1215
  {
1216
1216
  name: 'anchor',
1217
- regex: /<(a)[^><]*href\s*=\s*(['"])(.*?)\2(?:".*?"|'.*?'|[^'"><])*>([\s\S]*?)<\/\1>(?![^<]*(<\/pre>|<\/code>))/gi,
1218
- replacement: (_extras, _match, _g1, _g2, g3, g4) => {
1219
- const email = g3.startsWith('mailto:') ? g3.slice(7) : '';
1220
- if (email === g4) {
1221
- return email;
1217
+ regex: /(\]\()?<(a)[^><]*href\s*=\s*(['"])(.*?)\3(?:".*?"|'.*?'|[^'"><])*>([\s\S]*?)<\/\2>(?![^<]*(<\/pre>|<\/code>))/gi,
1218
+ replacement: (_extras, _match, g1, _g2, _g3, g4, g5) => {
1219
+ const incompleteLinkStart = g1 !== null && g1 !== void 0 ? g1 : '';
1220
+ const email = g4.startsWith('mailto:') ? g4.slice(7) : '';
1221
+ if (email === g5) {
1222
+ return `${incompleteLinkStart}${email}`;
1222
1223
  }
1223
- return `[${g4}](${email || g3})`;
1224
+ // An autolinked URL right after an incomplete link's `](` has to stay bare, or the link nests a copy of it
1225
+ if (incompleteLinkStart && (g4 === g5 || g4 === `https://${g5}`)) {
1226
+ return `${incompleteLinkStart}${g5}`;
1227
+ }
1228
+ return `${incompleteLinkStart}[${g5}](${email || g4})`;
1224
1229
  },
1225
1230
  },
1226
1231
  {
@@ -1176,13 +1176,18 @@ class ExpensiMark {
1176
1176
  },
1177
1177
  {
1178
1178
  name: 'anchor',
1179
- regex: /<(a)[^><]*href\s*=\s*(['"])(.*?)\2(?:".*?"|'.*?'|[^'"><])*>([\s\S]*?)<\/\1>(?![^<]*(<\/pre>|<\/code>))/gi,
1180
- replacement: (_extras, _match, _g1, _g2, g3, g4) => {
1181
- const email = g3.startsWith('mailto:') ? g3.slice(7) : '';
1182
- if (email === g4) {
1183
- return email;
1179
+ regex: /(\]\()?<(a)[^><]*href\s*=\s*(['"])(.*?)\3(?:".*?"|'.*?'|[^'"><])*>([\s\S]*?)<\/\2>(?![^<]*(<\/pre>|<\/code>))/gi,
1180
+ replacement: (_extras, _match, g1, _g2, _g3, g4, g5) => {
1181
+ const incompleteLinkStart = g1 !== null && g1 !== void 0 ? g1 : '';
1182
+ const email = g4.startsWith('mailto:') ? g4.slice(7) : '';
1183
+ if (email === g5) {
1184
+ return `${incompleteLinkStart}${email}`;
1184
1185
  }
1185
- return `[${g4}](${email || g3})`;
1186
+ // An autolinked URL right after an incomplete link's `](` has to stay bare, or the link nests a copy of it
1187
+ if (incompleteLinkStart && (g4 === g5 || g4 === `https://${g5}`)) {
1188
+ return `${incompleteLinkStart}${g5}`;
1189
+ }
1190
+ return `${incompleteLinkStart}[${g5}](${email || g4})`;
1186
1191
  },
1187
1192
  },
1188
1193
  {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "expensify-common",
3
- "version": "2.0.208",
3
+ "version": "2.0.209",
4
4
  "author": "Expensify, Inc.",
5
5
  "description": "Expensify libraries and components shared across different repos",
6
6
  "homepage": "https://expensify.com",