Skip to content
Browse files

Merge branch 'next'

  • Loading branch information...
2 parents 22585d4 + 897d3e4 commit 56ddf6a3c806efeb6df04b642cf0a91e6fcfdd0a @mojombo mojombo committed
Showing with 62 additions and 2 deletions.
  1. +1 −0 History.txt
  2. +4 −0 bin/jekyll
  3. +7 −0 features/site_configuration.feature
  4. +3 −2 jekyll.gemspec
  5. +3 −0 lib/jekyll.rb
  6. +11 −0 lib/jekyll/converters/markdown.rb
  7. +1 −0 test/helper.rb
  8. +21 −0 test/test_redcarpet.rb
  9. +11 −0 test/test_tags.rb
View
1 History.txt
@@ -1,6 +1,7 @@
== HEAD
* Major Enhancements
* Add command line importer functionality (#253)
+ * Add Recarpet Markdown support (#318)
* Minor Enhancements
* Switch to Albino gem
* Bundler support
View
4 bin/jekyll
@@ -82,6 +82,10 @@ opts = OptionParser.new do |opts|
opts.on("--rdiscount", "Use rdiscount gem for Markdown") do
options['markdown'] = 'rdiscount'
end
+
+ opts.on("--redcarpet", "Use redcarpet gem for Markdown") do
+ options['markdown'] = 'redcarpet'
+ end
opts.on("--kramdown", "Use kramdown gem for Markdown") do
options['markdown'] = 'kramdown'
View
7 features/site_configuration.feature
@@ -55,6 +55,13 @@ Feature: Site configuration
Then the _site directory should exist
And I should see "<a href="http://google.com">Google</a>" in "_site/index.html"
+ Scenario: Use Redcarpet for markup
+ Given I have an "index.markdown" page that contains "[Google](http://google.com)"
+ And I have a configuration file with "markdown" set to "redcarpet"
+ When I run jekyll
+ Then the _site directory should exist
+ And I should see "<a href="http://google.com">Google</a>" in "_site/index.html"
+
Scenario: Use Maruku for markup
Given I have an "index.markdown" page that contains "[Google](http://google.com)"
And I have a configuration file with "markdown" set to "maruku"
View
5 jekyll.gemspec
@@ -32,10 +32,11 @@ Gem::Specification.new do |s|
s.add_development_dependency('redgreen', ">= 1.2.2")
s.add_development_dependency('shoulda', ">= 2.11.3")
s.add_development_dependency('rr', ">= 1.0.2")
- s.add_development_dependency('cucumber', ">= 0.10.0")
+ s.add_development_dependency('cucumber', ">= 0.10.3")
s.add_development_dependency('RedCloth', ">= 4.2.1")
s.add_development_dependency('rdiscount', ">= 1.6.5")
-
+ s.add_development_dependency('redcarpet', ">= 1.9.0")
+
# = MANIFEST =
s.files = %w[
History.txt
View
3 lib/jekyll.rb
@@ -76,6 +76,9 @@ module Jekyll
'rdiscount' => {
'extensions' => []
},
+ 'redcarpet' => {
+ 'extensions' => []
+ },
'kramdown' => {
'auto_ids' => true,
'footnote_nr' => 1,
View
11 lib/jekyll/converters/markdown.rb
@@ -10,6 +10,15 @@ def setup
return if @setup
# Set the Markdown interpreter (and Maruku self.config, if necessary)
case @config['markdown']
+ when 'redcarpet'
+ begin
+ require 'redcarpet'
+ @redcarpet_extensions = @config['redcarpet']['extensions'].map { |e| e.to_sym }
+ rescue LoadError
+ STDERR.puts 'You are missing a library required for Markdown. Please run:'
+ STDERR.puts ' $ [sudo] gem install redcarpet'
+ raise FatalException.new("Missing dependency: redcarpet")
+ end
when 'kramdown'
begin
require 'kramdown'
@@ -77,6 +86,8 @@ def output_ext(ext)
def convert(content)
setup
case @config['markdown']
+ when 'redcarpet'
+ Redcarpet.new(content, *@redcarpet_extensions).to_html
when 'kramdown'
# Check for use of coderay
if @config['kramdown']['use_coderay']
View
1 test/helper.rb
@@ -6,6 +6,7 @@
require 'RedCloth'
require 'rdiscount'
require 'kramdown'
+require 'redcarpet'
require 'redgreen' if RUBY_VERSION < '1.9'
require 'shoulda'
View
21 test/test_redcarpet.rb
@@ -0,0 +1,21 @@
+require File.dirname(__FILE__) + '/helper'
+
+class TestRedcarpet < Test::Unit::TestCase
+ context "redcarpet" do
+ setup do
+ config = {
+ 'redcarpet' => { 'extensions' => ['smart'] },
+ 'markdown' => 'redcarpet'
+ }
+ @markdown = MarkdownConverter.new config
+ end
+
+ should "pass redcarpet options" do
+ assert_equal "<h1>Some Header</h1>", @markdown.convert('# Some Header #').strip
+ end
+
+ should "pass redcarpet extensions" do
+ assert_equal "<p>&ldquo;smart&rdquo;</p>", @markdown.convert('"smart"').strip
+ end
+ end
+end
View
11 test/test_tags.rb
@@ -125,5 +125,16 @@ def fill_post(code, override = {})
assert_match %r{<em>FINISH HIM</em>}, @result
end
end
+
+ context "using Redcarpet" do
+ setup do
+ create_post(@content, 'markdown' => 'redcarpet')
+ end
+
+ should "parse correctly" do
+ assert_match %r{<em>FIGHT!</em>}, @result
+ assert_match %r{<em>FINISH HIM</em>}, @result
+ end
+ end
end
end

0 comments on commit 56ddf6a

Please sign in to comment.
Something went wrong with that request. Please try again.