Title / Description
Code module ApplicationHelper class MarkdownRenderer < Redcarpet::Render::HTML def block_code(code, language) CodeRay.highlight(code, language) end end def markdown(text) rndr = MarkdownRenderer.new(:filter_html => true, :hard_wrap => true) options = { :fenced_code_blocks => true, :no_intra_emphasis => true, :autolink => true, :strikethrough => true, :lax_html_blocks => true, :superscript => true } markdown_to_html = Redcarpet::Markdown.new(rndr, options) markdown_to_html.render(text).html_safe end end
Author
Highlight as C C++ CSS Clojure Delphi ERb Groovy (beta) HAML HTML JSON Java JavaScript PHP Plain text Python Ruby SQL XML YAML diff code