Principled way to find and replace links in live preview mode

I develop a plugin which lets you write, e.g., [[w:JavaScript]] and have it rendered as an external link to Wikipedia.

The way the plugin detects links (both wikilinks and external links) in live preview mode is by fuzzy-matching on hard-coded lists of node names:

I keep having to add more patterns to this list. Is there a better way?