By the first look on https://github.com/discourse/discourse-linkify-words/blob/master/common/head_tag.html It looks like you need to replace middle part of a script.
- Attach word-link script, so
WordLink
module is available in a scope. - Get words to be replaced from
settings.linked_words
variable. - Apply
WordLink
to the text like the following:
const linkify = function(element) {
const newElement = element.cloneNode(true);
newElement.innerHTML = WordLink.apply(element.innerHTML, word, url);
return newElement;
};
api.decorateCooked(linkify);
I haven’t tested the code, it may require some corrections.