Skip to content

Instantly share code, notes, and snippets.

Created April 30, 2014 08:02
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save anonymous/752547b5c480391893aa to your computer and use it in GitHub Desktop.
Save anonymous/752547b5c480391893aa to your computer and use it in GitHub Desktop.
# in app/helpers/application_helper.rb
module ApplicationHelper
def md(text)
kramdown_doc = Kramdown::Document.new(text, parse_block_html: true, auto_id_stripping: true,
coderay_tab_width: 2).to_remove_html_tags(remove_span_html_tags: true)
Kramdown::Converter::Html.convert(kramdown_doc).join.html_safe
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment