unicorn_crack
unicorn_crack

Reputation: 1099

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

Upvotes: 6

Views: 2496

Answers (1)

unicorn_crack
unicorn_crack

Reputation: 1099

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)

Upvotes: 14

Related Questions