Skip to content

Instantly share code, notes, and snippets.

@TopRoupi
Created December 29, 2019 14:15
Show Gist options
  • Save TopRoupi/c4c556ff42558ee2962fdfa5b0c89f82 to your computer and use it in GitHub Desktop.
Save TopRoupi/c4c556ff42558ee2962fdfa5b0c89f82 to your computer and use it in GitHub Desktop.
module ApplicationHelper
def markdown(content)
return '' if content.blank?
markdown = Redcarpet::Markdown.new(Redcarpet::Render::XHTML,
autolink: true,
space_after_headers: true,
tables: true)
markdown.render(content)
sanitize(markdown.render(content)).html_safe
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment