I want to convert markdown to html. In my views I have markdown(some_text_variable)
but I get the error undefined method markdown
.
I added require 'BlueCoth'
to enviroment.rb and I installed the BlueCloth gem. Can anybody help me?
In your Gemfile:
gem 'bluecloth'
and don't forget to run
bundle install
when you need to convert markdown to html, simply use:
markdown = BlueCloth.new(some_text_variable).to_html
You can use it in a view:
<%= markdown.html_safe %>
You can use RDiscount https://github.com/rtomayko/rdiscount
The #markdown
helper was removed in Rails 3.
You can copy & paste the code from the commit or use a third party Gem, like formatize. You will also have to include the required BlueCloth
/RedCloth
/etc gem in your Gemfile
.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With