When you go to bb-ruby gem readme, there is an instruction how to extend it with your own translations:

my_block = {
  'Quote' => [
    '<div class="quote"><p>\2</p><block>\3</block></div>',
    'Quote with citation',
    '[quote=mike]please quote me[/quote]',


This method works quite good but well… it’s way to inconvenient. Where should we put our translation? In our model? Should we create a different model which would store our costume translations? Nah… There is really easy and clean way to add new (and overwrite already existing) translations into a bbcode parser.

Create in your app initializers directory (/config/initializers/) a file called bb-ruby.rb. Below you can see an example with [spoiler][/spoiler] tag:

module BBRuby
  if @@tags
    @@tags['Spoiler'] = [
      '<span class="spoiler">\1</span>',

And how to overwrite existing translation? Just replace it with new one. Below example which replaces standard “Link” rule, with same rule but with rel=”nofollow”:

@@tags['Link'] = [
  '<a href="\1" rel="nofollow">\2</a>',
  'Hyperlink to somewhere else',
  'Maybe try looking on [url=http://google.com]Google[/url]?',