JSFiddle - React, Tailwind, and code Playground
HTML
oögqegerloremogemqloremowmhg
JavaScript
$("body").contents().filter(function() {
return this.nodeType === 3;
}).each(function() {
ele = $(this).wrap("<span></span>").parent();
ele.html(ele.text().replace(/lorem/g, '<img src="http://ulrichbangert.de/thumbs/2015-10-24_Roseburg_Kuerbisfest_16_th.jpg">lorem'));
});