Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Redcarpet 2.0.1

I'm following this tutorial but it keeps failing saying "undefined method `new' for Redcarpet:Module". I have gem "redcarpet" in my Gemfile. The piece of code that is failing:

Redcarpet.new(@post.content).to_html
like image 469
unicorn_crack Avatar asked Dec 27 '11 17:12

unicorn_crack


1 Answers

Okay, it looks like Redcarpet 2 has completely changed the API. The following works:

markdown = Redcarpet::Markdown.new(Redcarpet::Render::HTML,
    :autolink => true, :space_after_headers => true)
raw markdown.render(@post_content.content)
like image 185
unicorn_crack Avatar answered Sep 28 '22 02:09

unicorn_crack