Skip to content

Commit

Permalink
allow use of rdiscount if --rdiscount is set and gem is installed
Browse files Browse the repository at this point in the history
  • Loading branch information
mojombo committed Dec 15, 2008
1 parent b0004e8 commit 5908027
Show file tree
Hide file tree
Showing 5 changed files with 22 additions and 3 deletions.
1 change: 1 addition & 0 deletions History.txt
@@ -1,6 +1,7 @@
==
* Major Changes
* Use Maruku (pure Ruby) for Markdown by default [github.com/mreid]
* Allow use of RDiscount with --rdiscount flag
* Minor Enhancements
* Don't load directory_watcher unless it's needed [github.com/pjhyett]

Expand Down
9 changes: 8 additions & 1 deletion README.textile
Expand Up @@ -80,7 +80,7 @@ The best way to install Jekyll is via RubyGems:
$ sudo gem install mojombo-jekyll -s http://gems.github.com/

Jekyll requires the gems `directory_watcher`, `liquid`, `open4`,
and `maruku` for markdown support. These are automatically
and `maruku` (for markdown support). These are automatically
installed by the gem install command.

Maruku comes with optional support for LaTeX to PNG rendering via
Expand Down Expand Up @@ -123,6 +123,13 @@ during the conversion:

$ jekyll --pygments

By default, Jekyll uses "Maruku":http://maruku.rubyforge.org (pure Ruby) for
Markdown support. If you'd like to use RDiscount (faster, but requires
compilation), you must install it (gem install rdiscount) and then you can
have it used instead:

$ jekyll --rdiscount

h2. Data

Jekyll traverses your site looking for files to process. Any files with YAML
Expand Down
10 changes: 10 additions & 0 deletions bin/jekyll
Expand Up @@ -32,6 +32,16 @@ opts = OptionParser.new do |opts|
opts.on("--pygments", "Use pygments to highlight code") do
Jekyll.pygments = true
end

opts.on("--rdiscount", "Use rdiscount gem for Markdown") do
begin
require 'rdiscount'
Jekyll.markdown_proc = Proc.new { |x| RDiscount.new(x).to_html }
puts 'Using rdiscount for Markdown'
rescue LoadError
puts 'You must have the rdiscount gem installed first'
end
end
end

opts.parse!
Expand Down
3 changes: 2 additions & 1 deletion lib/jekyll.rb
Expand Up @@ -44,11 +44,12 @@ module Jekyll
VERSION = '0.2.0'

class << self
attr_accessor :source, :dest, :lsi, :pygments
attr_accessor :source, :dest, :lsi, :pygments, :markdown_proc
end

Jekyll.lsi = false
Jekyll.pygments = false
Jekyll.markdown_proc = Proc.new { |x| Maruku.new(x).to_html }

def self.process(source, dest)
require 'classifier' if Jekyll.lsi
Expand Down
2 changes: 1 addition & 1 deletion lib/jekyll/convertible.rb
Expand Up @@ -30,7 +30,7 @@ def transform
self.content = RedCloth.new(self.content).to_html
when ".markdown":
self.ext = ".html"
self.content = Maruku.new(self.content).to_html
self.content = Jekyll.markdown_proc.call(self.content)
end
end

Expand Down

0 comments on commit 5908027

Please sign in to comment.