Skip to content

Commit

Permalink
Use new logic to check bold text
Browse files Browse the repository at this point in the history
  • Loading branch information
ShridharGoel authored May 30, 2024
1 parent 5002fbf commit 831288f
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion lib/ExpensiMark.js
Original file line number Diff line number Diff line change
Expand Up @@ -408,7 +408,14 @@ export default class ExpensiMark {
{
name: 'bold',
regex: /<(b|strong)(?:"[^"]*"|'[^']*'|[^'">])*>([\s\S]*?)<\/\1>(?![^<]*(<\/pre>|<\/code>))/gi,
replacement: '*$2*',
replacement: (match, tagContent, innerContent) => {
const isFontWeightBold = () => {

Check failure on line 412 in lib/ExpensiMark.js

View workflow job for this annotation

GitHub Actions / lint

Unexpected block statement surrounding arrow body; move the returned value immediately after the `=>`
return (fontWeightMatch[1].replaceAll(/\s/g,'').includes('font-weight:bold;') || fontWeightMatch[1].replaceAll(/\s/g,'').includes('font-weight:700;'))

Check failure on line 413 in lib/ExpensiMark.js

View workflow job for this annotation

GitHub Actions / lint

'fontWeightMatch' was used before it was defined

Check failure on line 413 in lib/ExpensiMark.js

View workflow job for this annotation

GitHub Actions / lint

'fontWeightMatch' was used before it was defined
}
const fontWeightMatch = innerContent.match(/style="(.*?)"/);
const isBold = fontWeightMatch ? (isFontWeightBold() ? true : false) : true;

Check failure on line 416 in lib/ExpensiMark.js

View workflow job for this annotation

GitHub Actions / lint

Do not nest ternary expressions

Check failure on line 416 in lib/ExpensiMark.js

View workflow job for this annotation

GitHub Actions / lint

Unnecessary use of boolean literals in conditional expression
return isBold ? `*${innerContent}*` : innerContent;
},
},
{
name: 'strikethrough',
Expand Down

0 comments on commit 831288f

Please sign in to comment.