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
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
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)
markdown.render(@post_content.content).html_safe
which also works. Not a fan of using raw
anymore. –
Eiser © 2022 - 2024 — McMap. All rights reserved.