J2M
J2M copied to clipboard
Multiple bold or italic sections in one string are not handled properly
String like "test str _first italic section_ some text _second italic section_ some later text" handled like "test str first italic section_ some text _second italic section some later text" Same problem related to bold sections. To fix it regex should be corrected: Instead of
// Bold
.replace(/\*(\S.*)\*/g, '**$1**')
// Italic
.replace(/\_(\S.*)\_/g, '*$1*')
Should be
// Bold
.replace(/\*(\S[^*]*)\*/g, '**$1**')
// Italic
.replace(/\_(\S[^_]*)\_/g, '*$1*')