diff --git a/lib/ExpensiMark.ts b/lib/ExpensiMark.ts index 9d0eb89b1..cdb216940 100644 --- a/lib/ExpensiMark.ts +++ b/lib/ExpensiMark.ts @@ -547,7 +547,14 @@ export default class ExpensiMark { { name: 'bold', regex: /<(b|strong)(?:"[^"]*"|'[^']*'|[^'">])*>([\s\S]*?)<\/\1>(?![^<]*(<\/pre>|<\/code>))/gi, - replacement: '*$2*', + replacement: (match, tagContent, innerContent) => { + const fontWeightMatch = innerContent.match(/style="(.*?)"/); + 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; + }, }, { name: 'strikethrough',