linkifyWikiText(unsafeText) {
        /** @param {import('d3').Selection} selection */
        return (selection) => {
            const segments = unsafeText.split(/(key|tag):([\w-]+)(=([\w-]+))?/g);

            for (let i = 0; i < segments.length; i += 5) {
                const [plainText, , key, , value] = segments.slice(i);

                if (plainText) {
                    selection
                        .append('span')
                        .text(plainText);
                }

                if (key) {
                    selection
                        .append('a')
                        .attr('href', `https://wiki.openstreetmap.org/wiki/${this.toSitelink(key, value)}`)
                        .attr('target', '_blank')
                        .attr('rel', 'noreferrer')
                        .append('code')
                            .text(`${key}=${value || '*'}`);
                }
            }
        };
    }
Converts text like `tag:...=...` into clickable links

@param {string} unsafeText - unsanitized text