diff --git a/lib/ExpensiMark.js b/lib/ExpensiMark.js index 3f66cf93..dfc96593 100644 --- a/lib/ExpensiMark.js +++ b/lib/ExpensiMark.js @@ -410,7 +410,7 @@ export default class ExpensiMark { regex: /<(b|strong)(?:"[^"]*"|'[^']*'|[^'">])*>([\s\S]*?)<\/\1>(?![^<]*(<\/pre>|<\/code>))/gi, replacement: (match, tagContent, innerContent) => { const fontWeightMatch = innerContent.match(/style="(.*?)"/); - const isFontWeightBold = fontWeightMatch[1].replaceAll(/\s/g,'').includes('font-weight:bold;') || fontWeightMatch[1].replaceAll(/\s/g,'').includes('font-weight:700;') + const isFontWeightBold = fontWeightMatch ? fontWeightMatch[1].replaceAll(/\s/g,'').includes('font-weight:bold;') || fontWeightMatch[1].replaceAll(/\s/g,'').includes('font-weight:700;') : false; const isBold = fontWeightMatch ? isFontWeightBold : true; return isBold ? `*${innerContent}*` : innerContent; },