diff --git a/README.textile b/README.textile index 0ed13e8f..fe28d6e7 100644 --- a/README.textile +++ b/README.textile @@ -315,6 +315,12 @@ Convert an array into a sentence. becomes foo, bar, and baz + +h3. Textilize + +Convert a Textile-formatted string into HTML, formatted via RedCloth + + {{ page.excerpt | textilize }} h3. Include (Tag) diff --git a/lib/jekyll/filters.rb b/lib/jekyll/filters.rb index cb7c5d51..6bb08096 100644 --- a/lib/jekyll/filters.rb +++ b/lib/jekyll/filters.rb @@ -1,6 +1,10 @@ module Jekyll module Filters + def textilize(input) + RedCloth.new(input).to_html + end + def date_to_string(date) date.strftime("%d %b %Y") end diff --git a/test/test_filters.rb b/test/test_filters.rb index 9cd25f6d..e6700191 100644 --- a/test/test_filters.rb +++ b/test/test_filters.rb @@ -10,6 +10,10 @@ class TestFilters < Test::Unit::TestCase @filter = JekyllFilter.new end + def test_textilize_with_simple_string + assert_equal "

something really simple

", @filter.textilize("something *really* simple") + end + def test_array_to_sentence_string_with_no_args assert_equal "", @filter.array_to_sentence_string([]) end