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.
- package/dist/ExpensiMark.js +11 -6
- package/dist/esm/ExpensiMark.js +11 -6
- package/package.json +1 -1
package/dist/ExpensiMark.js
CHANGED
|
@@ -1214,13 +1214,18 @@ class ExpensiMark {
|
|
|
1214
1214
|
},
|
|
1215
1215
|
{
|
|
1216
1216
|
name: 'anchor',
|
|
1217
|
-
regex:
|
|
1218
|
-
replacement: (_extras, _match,
|
|
1219
|
-
const
|
|
1220
|
-
|
|
1221
|
-
|
|
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
|
-
|
|
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
|
{
|
package/dist/esm/ExpensiMark.js
CHANGED
|
@@ -1176,13 +1176,18 @@ class ExpensiMark {
|
|
|
1176
1176
|
},
|
|
1177
1177
|
{
|
|
1178
1178
|
name: 'anchor',
|
|
1179
|
-
regex:
|
|
1180
|
-
replacement: (_extras, _match,
|
|
1181
|
-
const
|
|
1182
|
-
|
|
1183
|
-
|
|
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
|
-
|
|
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
|
{
|