kehying do you have some existing code so far? Which parameters need to be customizable via the bbcode parameters?
There are a few examples for basic bbcode, like https://github.com/clarkwinkelmann/flarum-ext-comicsans/blob/master/extend.php or you could also make this work based on native links (for example, insert [Submit](mailto:info@example.com)
then use the javascript to target all mailto:
links)
The most reliable solution would be to not use inline javascript but create a javascript extension and use CommentPost.prototype.oncreate
/onupdate
to run a bit of javascript that will look for this.$('a[href^=mailto:]')
and perform the URL replacement there. You might also need to extend s9e.TextFormatter.preview
if you want the logic to execute in previews, like for example the emoji extension does.
For your use case, inline javascript in the bbcode template might also work, but I can't find any good example for it. I wouldn't recommend inline javascript though.