From 0410ff3c20c0ed4998fbe0a6b9dc1952dd4f3437 Mon Sep 17 00:00:00 2001 From: Shridhar Goel <35566748+ShridharGoel@users.noreply.github.com> Date: Wed, 5 Jun 2024 12:54:58 +0530 Subject: [PATCH] Update ExpensiMark.js --- lib/ExpensiMark.js | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/lib/ExpensiMark.js b/lib/ExpensiMark.js index 61608418..3f66cf93 100644 --- a/lib/ExpensiMark.js +++ b/lib/ExpensiMark.js @@ -409,11 +409,9 @@ export default class ExpensiMark { name: 'bold', regex: /<(b|strong)(?:"[^"]*"|'[^']*'|[^'">])*>([\s\S]*?)<\/\1>(?![^<]*(<\/pre>|<\/code>))/gi, replacement: (match, tagContent, innerContent) => { - const isFontWeightBold = () => { - return (fontWeightMatch[1].replaceAll(/\s/g,'').includes('font-weight:bold;') || fontWeightMatch[1].replaceAll(/\s/g,'').includes('font-weight:700;')) - } const fontWeightMatch = innerContent.match(/style="(.*?)"/); - const isBold = fontWeightMatch ? (isFontWeightBold() ? true : false) : true; + const isFontWeightBold = fontWeightMatch[1].replaceAll(/\s/g,'').includes('font-weight:bold;') || fontWeightMatch[1].replaceAll(/\s/g,'').includes('font-weight:700;') + const isBold = fontWeightMatch ? isFontWeightBold : true; return isBold ? `*${innerContent}*` : innerContent; }, },