Skip to content

Instantly share code, notes, and snippets.

@Arcath
Created July 16, 2012 08:48
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save Arcath/3121601 to your computer and use it in GitHub Desktop.
Markabb 1.0.0 Release post Code
upcaser = Markabb::Callback.new(Proc.new { |s|
s.upcase
})
Markabb.register_tag :upcase, Markabb::Tag.new('up', upcaser)
"[up]FooBAr[/up]".markabb # > FOOBAR
Markabb.configure do |c|
c.disable_formatting = true
end
Markabb.configure do |c|
end
Markabb.register_tag :bold_and_italic, Markabb::Tag.new('bi','<b><i>\1</i></b>')
# Directly on a string
"[b]Bold[/b]".markabb # > <b>Bold</b>
# By calling Parse
Markabb.parse "[b]Bold[/b]" # > <b>Bold</b>
# By calling Parse with a block
Markabb.parse "[b]Bold[/b]" do |c|
c.disable_formatting = true
end # > [b]Bold[/b]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment