JSFiddle - React, Tailwind, and code Playground
HTML
<div class="comments">comment 1** isgood**</div>
<div class="comments">comment 2**isbad**</div>
JavaScript
function markdown(markdownable) {
var bold = /\*\*(\S(.*?\S)?)\*\*/gm;
markdownable = markdownable.replace( bold, '<span style="font-weight:bold">$1</span>' );
return markdownable;
}
$('.comments').each(function() {
var markdownable = $(this).html(),
comments = markdown(markdownable);
$(this).html(comments);
});