Reversed the order of Discount and RPEG-Markdown, due to reports on their relative...
[git-blog.git] / lib / git-blog / parser / markdown.rb
blobbe571b56337c00ea4e883a49b61049d5027d8286
1 # Discount
2 begin
3   require 'rdiscount'
4   Markdown = RDiscount
5   
6 # rpeg-markdown
7 rescue LoadError
8   begin
9     require 'markdown'
10   
11   # Maruku
12   rescue LoadError
13     begin
14       require 'maruku'
15       Markdown = Maruku
16     
17     # BlueCloth
18     rescue LoadError
19       require 'bluecloth'
20       Markdown = BlueCloth
21     end
22   end
23 end
25 module GitBlog
26   module Parsers
27     module Markdown
28       def self.parse input
29         input.gsub!(/^(.*)\n=+(\n\s+)*\n/m, '')
30         ::Markdown.new(input).to_html
31       end
32     end
33   end
34 end