expensify-common 2.0.5 → 2.0.6
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 +12 -12
- package/package.json +1 -1
package/dist/ExpensiMark.js
CHANGED
|
@@ -277,20 +277,20 @@ class ExpensiMark {
|
|
|
277
277
|
return `<blockquote>${isStartingWithSpace ? ' ' : ''}${replacedText}</blockquote>`;
|
|
278
278
|
},
|
|
279
279
|
},
|
|
280
|
+
/**
|
|
281
|
+
* Use \b in this case because it will match on words, letters,
|
|
282
|
+
* and _: https://www.rexegg.com/regex-boundaries.html#wordboundary
|
|
283
|
+
* Use [\s\S]* instead of .* to match newline
|
|
284
|
+
*/
|
|
280
285
|
{
|
|
281
|
-
/**
|
|
282
|
-
* Use \b in this case because it will match on words, letters,
|
|
283
|
-
* and _: https://www.rexegg.com/regex-boundaries.html#wordboundary
|
|
284
|
-
* The !_blank is to prevent the `target="_blank">` section of the
|
|
285
|
-
* link replacement from being captured Additionally, something like
|
|
286
|
-
* `\b\_([^<>]*?)\_\b` doesn't work because it won't replace
|
|
287
|
-
* `_https://www.test.com_`
|
|
288
|
-
* Use [\s\S]* instead of .* to match newline
|
|
289
|
-
*/
|
|
290
286
|
name: 'italic',
|
|
291
|
-
regex: /(
|
|
292
|
-
|
|
293
|
-
|
|
287
|
+
regex: /(<(pre|code|a|mention-user)[^>]*>(.*?)<\/\2>)|((\b_+|\b)_((?![\s_])[\s\S]*?[^\s_](?<!\s))_(?![^\W_])(?![^<]*>)(?![^<]*(<\/pre>|<\/code>|<\/a>|<\/mention-user>)))/g,
|
|
288
|
+
replacement: (match, html, tag, content, text, extraLeadingUnderscores, textWithinUnderscores) => {
|
|
289
|
+
// Skip any <pre>, <code>, <a>, <mention-user> tag contents
|
|
290
|
+
if (html) {
|
|
291
|
+
return html;
|
|
292
|
+
}
|
|
293
|
+
// If any tags are included inside underscores, ignore it. ie. _abc <pre>pre tag</pre> abc_
|
|
294
294
|
if (textWithinUnderscores.includes('</pre>') || this.containsNonPairTag(textWithinUnderscores)) {
|
|
295
295
|
return match;
|
|
296
296
|
}
|