Created
November 7, 2008 14:40
-
-
Save mudge/22874 to your computer and use it in GitHub Desktop.
Maruku helper for Rails.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# For Rails 2.3.2 or earlier. | |
require 'maruku' # or use config.gem "maruku" in environment.rb | |
module ApplicationHelper | |
# Replacement for Rails' default Markdown helper which uses Maruku instead | |
# of BlueCloth. | |
def markdown(text) | |
text.blank? ? "" : Maruku.new(text).to_html | |
end | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# For Rails 2.3.3 or later. | |
# Add a gem dependency on "maruku" with either config.gem or your Gemfile | |
# (depending on your version of Rails) and then add this file to | |
# config/initializers/ | |
Markdown = Maruku unless defined?(Markdown) |
hron84, thanks for the heads up: it seems that the markdown
helper was changed in Rails 2.3.3 so that it is no longer hard-coded as BlueCloth
. I've added your initializer above and commented that the helper override is only needed for older versions of Rails.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
It is unneeded.
Create an initializer with content:
and you will be happy.