Visual of the problem
text added:
*test*
detected:
Italic
correct detection:
Italic
Visual:

text added:
**test**
detected:
Bold and Italic
correct detection:
Bold
Visual:

text added:
***test***
detected:
Bold and Italic
correct detection:
Bold and Italic
Visual:

The problem is in the second case, because it only needs to detect bold and not italics.
I think it's for this part of the code word.js:
function containsItalic(text) {
return text.includes("*");
}
function containsBold(text) {
return text.includes("**");
}
need a better solution, but I really don't know what to do to fix it.