Skip to content
This repository has been archived by the owner on May 5, 2020. It is now read-only.

Commit

Permalink
Move from referencing the BlueCloth constant directly, to referencing…
Browse files Browse the repository at this point in the history
… Markdown.

This supports alternative implementations of markdown such as rpeg-markdown or rdiscount, and later releases of bluecloth.  There are some performance issues with earlier releases of bluecloth, and you should probably upgrade.  In the event that you can't you can place the following code into an initializer:

  Markdown = BlueCloth
  • Loading branch information
NZKoz committed Jul 16, 2009
1 parent b3ec7b2 commit a147bec
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions actionpack/lib/action_view/helpers/text_helper.rb
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -271,8 +271,8 @@ def textilize_without_paragraph(text)
end end


# Returns the text with all the Markdown codes turned into HTML tags. # Returns the text with all the Markdown codes turned into HTML tags.
# <i>This method requires BlueCloth[http://www.deveiate.org/projects/BlueCloth] # <i>This method requires BlueCloth[http://www.deveiate.org/projects/BlueCloth] or another
# to be available</i>. # Markdown library to be installed.</i>.
# #
# ==== Examples # ==== Examples
# markdown("We are using __Markdown__ now!") # markdown("We are using __Markdown__ now!")
Expand All @@ -288,7 +288,7 @@ def textilize_without_paragraph(text)
# markdown('![The ROR logo](http://rubyonrails.com/images/rails.png "Ruby on Rails")') # markdown('![The ROR logo](http://rubyonrails.com/images/rails.png "Ruby on Rails")')
# # => '<p><img src="http://rubyonrails.com/images/rails.png" alt="The ROR logo" title="Ruby on Rails" /></p>' # # => '<p><img src="http://rubyonrails.com/images/rails.png" alt="The ROR logo" title="Ruby on Rails" /></p>'
def markdown(text) def markdown(text)
text.blank? ? "" : BlueCloth.new(text).to_html text.blank? ? "" : Markdown.new(text).to_html
end end


# Returns +text+ transformed into HTML using simple formatting rules. # Returns +text+ transformed into HTML using simple formatting rules.
Expand Down

0 comments on commit a147bec

Please sign in to comment.