expensify-common 2.0.75 → 2.0.77
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 +4 -3
- package/package.json +1 -1
package/dist/ExpensiMark.js
CHANGED
|
@@ -262,7 +262,7 @@ class ExpensiMark {
|
|
|
262
262
|
{
|
|
263
263
|
name: 'autolink',
|
|
264
264
|
process: (textToProcess, replacement) => {
|
|
265
|
-
const regex = new RegExp(`(?![^<]*>|[^<>]*<\\/(?!h1>))([_*~]*?)${UrlPatterns.MARKDOWN_URL_REGEX}\\1(?!((?:(?!<a).)+)?<\\/a>|[^<]*(<\\/pre>|<\\/code
|
|
265
|
+
const regex = new RegExp(`(?![^<]*>|[^<>]*<\\/(?!h1>))([_*~]*?)${UrlPatterns.MARKDOWN_URL_REGEX}\\1(?!((?:(?!<a).)+)?<\\/a>|[^<]*(<\\/pre>|<\\/code>))`, 'gi');
|
|
266
266
|
return this.modifyTextForUrlLinks(regex, textToProcess, replacement);
|
|
267
267
|
},
|
|
268
268
|
replacement: (_extras, _match, g1, g2) => {
|
|
@@ -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
|
|
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(
|
|
476
|
+
const nestedStyleMatch = nestedMatch.match(fontWeightRegex);
|
|
476
477
|
const isNestedBold = isBoldFromStyle(nestedStyleMatch ? nestedStyleMatch[1] : null);
|
|
477
478
|
return updateSpacesAndWrapWithAsterisksIfBold(nestedContent, isNestedBold);
|
|
478
479
|
});
|