Sha256: cff49fb0d669e7e851418133efd93b19d093e0146b83b2cc5c966e865838bc63
Contents?: true
Size: 854 Bytes
Versions: 5
Compression:
Stored size: 854 Bytes
Contents
require 'redcarpet' module ActiveAdminAddons class MarkdownBuilder < CustomBuilder def render return if data.blank? Redcarpet::Markdown.new(renderer, extensions).render(@data).html_safe end private def extensions_default { fenced_code_blocks: true, no_intra_emphasis: true, strikethrough: true, superscript: true } end def renderer_options_default { filter_html: true, hard_wrap: true } end def extensions @extensions ||= extensions_default.merge(options[:extensions] || {}) end def render_options @render_options ||= renderer_options_default.merge(options[:render_options] || {}) end def renderer @renderer ||= Redcarpet::Render::HTML.new(render_options) end end end ActiveAdminAddons::MarkdownBuilder.create_view_methods
Version data entries
5 entries across 5 versions & 1 rubygems