Skip to content

Commit

Permalink
Now supporting 4 Markdown parsers
Browse files Browse the repository at this point in the history
  • Loading branch information
ELLIOTTCABLE committed Jun 20, 2008
1 parent 3167241 commit 7f07e67
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 5 deletions.
7 changes: 6 additions & 1 deletion README.mkdn
Expand Up @@ -90,7 +90,12 @@ On a Linux or Windows machine, you're a bit more on your own, as I don't know ho
* `gem install git`
* `gem install haml` (if you wish to create your templates or write your posts in haml)
* `gem install RedCloth` (if you wish to write your posts in Textile)
* `gem install Maruku` (if you wish to write your posts in Markdown)
* One of the following Markdown libraries (if you wish to write your posts in Markdown)
** `sudo gem install rdiscount`
** `sudo gem install rpeg-markdown`
** `sudo gem install maruku`
** `sudo gem install BlueCloth`


To develop and contribute to git-blog, you also need:

Expand Down
29 changes: 25 additions & 4 deletions lib/git-blog/parser/markdown.rb
@@ -1,13 +1,34 @@
require 'maruku'
# rpeg-markdown
begin
require 'markdown'

# Discount
rescue LoadError
begin
require 'rdiscount'
Markdown = RDiscount

# Maruku
rescue LoadError
begin
require 'maruku'
Markdown = Maruku

# BlueCloth
rescue LoadError
require 'bluecloth'
Markdown = BlueCloth
end
end
end

module GitBlog
module Parsers
module Markdown
def self.parse input
input.gsub!(/^(.*)\n=+(\n\s+)*\n/m, '')
::Maruku.new(input).to_html
::Markdown.new(input).to_html
end
end
end
end

end

0 comments on commit 7f07e67

Please sign in to comment.