expensify-common 2.0.44 → 2.0.46
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 +10 -2
- package/package.json +1 -1
package/dist/ExpensiMark.js
CHANGED
|
@@ -368,8 +368,13 @@ class ExpensiMark {
|
|
|
368
368
|
// \B will match everything that \b doesn't, so it works
|
|
369
369
|
// for * and ~: https://www.rexegg.com/regex-boundaries.html#notb
|
|
370
370
|
name: 'bold',
|
|
371
|
-
regex: /(?<!<[^>]*)\B\*(?![^<]*(?:<\/pre>|<\/code>|<\/a>))((?![\s*])[\s\S]*?[^\s*](?<!\s))\*\B(?![^<]*>)(?![^<]*(<\/pre>|<\/code>|<\/a>))/g,
|
|
372
|
-
replacement: (_extras, match, g1) =>
|
|
371
|
+
regex: /(?<!<[^>]*)(\b_|\B)\*(?![^<]*(?:<\/pre>|<\/code>|<\/a>))((?![\s*])[\s\S]*?[^\s*](?<!\s))\*\B(?![^<]*>)(?![^<]*(<\/pre>|<\/code>|<\/a>))/g,
|
|
372
|
+
replacement: (_extras, match, g1, g2) => {
|
|
373
|
+
if (g1.includes('_')) {
|
|
374
|
+
return `${g1}<strong>${g2}</strong>`;
|
|
375
|
+
}
|
|
376
|
+
return g2.includes('</pre>') || this.containsNonPairTag(g2) ? match : `<strong>${g2}</strong>`;
|
|
377
|
+
},
|
|
373
378
|
},
|
|
374
379
|
{
|
|
375
380
|
name: 'strikethrough',
|
|
@@ -862,6 +867,9 @@ class ExpensiMark {
|
|
|
862
867
|
const replacedMatch = shouldKeepRawInput ? replacement(EXTRAS_DEFAULT, match[0], linkText, match[2], match[3]) : replacement(EXTRAS_DEFAULT, match[0], linkText, match[3]);
|
|
863
868
|
replacedText = replacedText.concat(replacedMatch);
|
|
864
869
|
startIndex = match.index + match[0].length;
|
|
870
|
+
// Line breaks (`\n`) followed by empty contents are already removed
|
|
871
|
+
// but line breaks inside contents should be parsed to <br/> to skip `autoEmail` rule
|
|
872
|
+
replacedText = this.replace(replacedText, { filterRules: ['newline'], shouldEscapeText: false });
|
|
865
873
|
// Now we move to the next match that the js regex found in the text
|
|
866
874
|
match = regex.exec(textToCheck);
|
|
867
875
|
}
|