JSFiddle - React, Tailwind, and code Playground

HTML

<div id="foo">
You should visit StackOverflow. I found it on Wikipedia.
</div>

JavaScript

$(function() {

    var text = $('#foo').text(),
        library = {
            stackoverflow: 'http://stackoverflow.com',
            wikipedia: 'http://wikipedia.com'
        },
        name;

    for (name in library) {
        text = text.replace(new RegExp(name, 'gi'), function(word) {
            return '<a href="' + library[name] + '">'+word+'</a>';
        });  
    };
                   
    $('#foo ').html(text);
});