Redcarpet 2.0.1

I follow this tutorial , but it continues to fail by saying "the undefined method is" new "to Redcarpet: Module." I have a redcarpet gem in my gemfile. A piece of code that doesn't work:

Redcarpet.new(@post.content).to_html 
+6
source share
1 answer

Well, 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) 
+14
source

Source: https://habr.com/ru/post/904547/


All Articles