Skip to content

Instantly share code, notes, and snippets.

@edwardloveall
Created April 13, 2012 00:23
Show Gist options
  • Save edwardloveall/2372221 to your computer and use it in GitHub Desktop.
Save edwardloveall/2372221 to your computer and use it in GitHub Desktop.
Markdown helper for Redcarpet ~> 2.1.1
def to_markdown(text)
md_renderer = Redcarpet::Render::HTML.new(:hard_wrap => true)
md_options = [:autolink => true]
markdown = Redcarpet::Markdown.new(md_renderer, *md_options)
markdown.render(text).html_safe
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment