diff --git a/lib/jekyll/filters.rb b/lib/jekyll/filters.rb index dbd9f5118d1..8fd3f4c0be7 100644 --- a/lib/jekyll/filters.rb +++ b/lib/jekyll/filters.rb @@ -12,6 +12,15 @@ def textilize(input) TextileConverter.new.convert(input) end + # Convert a Markdown string into HTML output using RDiscount. + # + # input - The Markdown String to convert. + # + # Returns the HTML formatted String. + def rdiscount(input) + RDiscount.new(input).to_html + end + # Format a date in short format e.g. "27 Jan 2011". # # date - the Time to format. diff --git a/test/test_filters.rb b/test/test_filters.rb index 4fa0b819a15..4b55431984b 100644 --- a/test/test_filters.rb +++ b/test/test_filters.rb @@ -14,6 +14,10 @@ class JekyllFilter assert_equal "

something really simple

", @filter.textilize("something *really* simple") end + should "rdiscount with simple string" do + assert_equal "

something really simple

\n", @filter.rdiscount("something **really** simple") + end + should "convert array to sentence string with no args" do assert_equal "", @filter.array_to_sentence_string([]) end