JSFiddle - React, Tailwind, and code Playground

HTML

<div>Text ™, ®, ©</div>
<div>
    <p>™</p>
    <b>®</b>
</div>

JavaScript

$('body :not(script)').contents().filter(function() {
    return this.nodeType === 3;
}).replaceWith(function() {
    return this.nodeValue.replace(/[™®©]/g, '<sup>$&</sup>');
});