Skip to content

Commit

Permalink
Update ExpensiMark.js
Browse files Browse the repository at this point in the history
  • Loading branch information
ShridharGoel authored Jun 5, 2024
1 parent 831288f commit 0410ff3
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions lib/ExpensiMark.js
Original file line number Diff line number Diff line change
@@ -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;
},
},

0 comments on commit 0410ff3

Please sign in to comment.