JSFiddle - React, Tailwind, and code Playground

HTML

<body>
<div class="main_content">
<div>
One
</div>
<div>
<p>
Two
</p>
</div>
<p>
Three
</p>
<div class="do-not-replace">
Four
</div>
</div>
</body>

JavaScript

jQuery(($) => {

const words = ["One", "Two", "Three", "Four"]
const area = $('body :not(script):not(textarea):not(.do-not-replace)');
var arrayLength = area.length;

for (var i = 0; i < arrayLength; i++) {
area.contents()
.filter(function() { return this.nodeType === 3 && this.nodeValue.match(words[i]);})
.replaceWith(function() {return this.nodeValue.replace(words[i], `<b class="replaced">${words[i]}</b>`);});
}
});