JSFiddle - React, Tailwind, and code Playground

HTML

<pre>
<code>
/**
 * Comment
 */

asdasda sd ada sd

/** asd asd asdsas da  */
function foo($bar){
    echo $bar . "in foo!";
}
/*comment3*/
</code>
</pre>

CSS

pre code .comment {
   color:gray;   
}

JavaScript

var commentPattern = /(\/\*[.\S\s]*?\*\/)/g

var t = $('pre code').html();
t = t.replace(commentPattern ,'<span class="comment">$1</span>');
console.log(t)
$('pre code').html( t );