I was directed to the Linkify project on GitHub (https://github.com/cowboy/javascript-linkify) for finding and \"linkifying\" URLs and domains just floating in text.
Additionally to previous answer I propose more short way (based on jQuery):
$(n).replaceWith('Some text with html support');
where n
- is textNode.
Or the native version
var txt = document.createElement("span");
txt.innerHTML = "Some text with html support";
node.replaceWith(txt);
where node
is the textNode