expensify-common 2.0.76 → 2.0.78

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.
@@ -116,8 +116,8 @@ class ExpensiMark {
116
116
  // Use the url escaped version of a backtick (`) symbol. Mobile platforms do not support lookbehinds,
117
117
  // so capture the first and third group and place them in the replacement.
118
118
  // but we should not replace backtick symbols if they include <pre> tags between them.
119
- regex: /(\B|_|)&#x60;(.*?(?![&#x60;])\S.*?)&#x60;(\B|_|)(?!&#x60;|[^<]*<\/pre>|[^<]*<\/video>)/gm,
120
- replacement: '$1<code>$2</code>$3',
119
+ regex: /(\B|_|)&#x60;((?:&#x60;)*)(?!&#x60;)(.*?\S+?.*?)(?<!&#x60;)((?:&#x60;)*)(&#x60;)(\B|_|)(?!&#x60;|[^<]*<\/pre>|[^<]*<\/video>)/gm,
120
+ replacement: '$1<code>$2$3$4</code>$6',
121
121
  },
122
122
  /**
123
123
  * Converts markdown style links to anchor tags e.g. [Expensify](concierge@expensify.com)
@@ -467,12 +467,13 @@ class ExpensiMark {
467
467
  return isBold ? `${leadingSpace}*${trimmedContent}*${trailingSpace}` : content;
468
468
  };
469
469
  // Determine if the outer tag is bold
470
- const styleAttributeMatch = match.match(/style="(.*?)"/);
470
+ const fontWeightRegex = /style="([^"]*?\bfont-weight:\s*(\d+|bold|normal)[^"]*?)"/;
471
+ const styleAttributeMatch = match.match(fontWeightRegex);
471
472
  const isFontWeightBold = isBoldFromStyle(styleAttributeMatch ? styleAttributeMatch[1] : null);
472
473
  const isBold = styleAttributeMatch ? isFontWeightBold : tagName === 'b' || tagName === 'strong';
473
474
  // Process nested spans with potential bold style
474
475
  const processedInnerContent = innerContent.replace(/<span(?:"[^"]*"|'[^']*'|[^'">])*>([\s\S]*?)<\/span>/gi, (nestedMatch, nestedContent) => {
475
- const nestedStyleMatch = nestedMatch.match(/style="(.*?)"/);
476
+ const nestedStyleMatch = nestedMatch.match(fontWeightRegex);
476
477
  const isNestedBold = isBoldFromStyle(nestedStyleMatch ? nestedStyleMatch[1] : null);
477
478
  return updateSpacesAndWrapWithAsterisksIfBold(nestedContent, isNestedBold);
478
479
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "expensify-common",
3
- "version": "2.0.76",
3
+ "version": "2.0.78",
4
4
  "author": "Expensify, Inc.",
5
5
  "description": "Expensify libraries and components shared across different repos",
6
6
  "homepage": "https://expensify.com",