Replacing special text to linkify them on posts

Hi, this is more like a question on how-to do something…

So, besides our forum we have a wiki (mediawiki) and in several of our topics we post links to that wiki.

Now, we just came from an SMF migration where the links were generated as bbcode, like this:
[wiki]Idrissa Doumbia[/wiki]
converted automatically to Doumbia

My question is, with Discourse these links are lost, meaning that what we see in topics are the bbcode tags with no linking. So I was wondering what would be the best strategy to put them working once again. Linkify component (haven’t really checked if this is the goal with that component)? Replacing text through rails (is it possible with these special characters and maintaining the string between the wiki tags to create the link)? Any other ideas?

1 Like

You could use the Linkify words in post theme component with the following (untested) setting:



Thanks. It works very well, the link is being generated as it should, the only problem is that the link title is [wiki]something-here[/wiki] instead of converting it to text something-here

1 Like

This is fixable, I have version of linkify that can convert text as well. Could you ping me next week? I’ll see what I can do.


If this is the only purpose for the linkify theme, you could modify the code directly.
Specifically, on the line 63 in /head_tag.html

link.innerHTML = text;

write this instead

link.innerHTML = captured.length == 1 ? captured[0] : text;

I havn’t tested this, could you try it? Let me know if you need more guidance.