JSFiddle - React, Tailwind, and code Playground

JavaScript

alert(wikifyText("[[", "]]", "There are cars, be careful, carefully, and with great care!!", ["text", "hoogahjush", "wikify", "car", "careful", "carefully", "great care", "great"]));

function wikifyText (startString, endString, text, list) {
    list = list.map( function (str) {
        return str.replace( /([^a-z0-9_])/g, '\\$1' );
    });
    list.sort();
    list.reverse();
    var re = new RegExp( '\\b(' + list.join('|') + ')\\b', 'g' );
    return text.replace( re, startString + '$1' + endString );
}