Skip to content

Commit

Permalink
Update utils.ts
Browse files Browse the repository at this point in the history
  • Loading branch information
sxjeru authored Aug 3, 2024
1 parent 7f4028c commit c3b891f
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/Markdown/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,10 @@ export function fixMarkdownBold(text: string): string {
if (char === '*') {
count++;
if (count % 2 === 0) {
if (i + 1 < text.length && text[i + 1] !== ' ') {
const prevChar = i > 0 ? text[i - 1] : '';
const isPrevCharAlphanumeric = /[a-zA-Z0-9]/.test(prevChar);

if (i + 1 < text.length && text[i + 1] !== ' ' && !isPrevCharAlphanumeric) {
result += '* ';
} else {
result += '*';
Expand Down

0 comments on commit c3b891f

Please sign in to comment.