Sha256: 4a2cc1e125606f5d16eba39ed4402bd344f497ef79465ded2922cc803685f1f7

Contents?: true

Size: 666 Bytes

Versions: 10

Compression:

Stored size: 666 Bytes

Contents

# frozen_string_literal: true

require "redcarpet"

module Decidim
  module DecidimAwesome
    module ContentRenderers
      # A renderer that processes markdown
      class MarkdownRenderer < Decidim::ContentRenderers::BaseRenderer
        # @return [String] the content ready to display (contains HTML)
        def render(options = { filter_html: true, autolink: true, no_intra_emphasis: true, fenced_code_blocks: true, disable_indented_code_blocks: true, tables: true })
          md = Redcarpet::Markdown.new(Redcarpet::Render::HTML, options).render(content)
          "<div class=\"awesome-markdown-editor\">#{md}</div>"
        end
      end
    end
  end
end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
decidim-decidim_awesome-0.7.0 lib/decidim/decidim_awesome/content_renderers/markdown_renderer.rb
decidim-decidim_awesome-0.6.7 lib/decidim/decidim_awesome/content_renderers/markdown_renderer.rb
decidim-decidim_awesome-0.6.6 lib/decidim/decidim_awesome/content_renderers/markdown_renderer.rb
decidim-decidim_awesome-0.6.5 lib/decidim/decidim_awesome/content_renderers/markdown_renderer.rb
decidim-decidim_awesome-0.6.4 lib/decidim/decidim_awesome/content_renderers/markdown_renderer.rb
decidim-decidim_awesome-0.6.3 lib/decidim/decidim_awesome/content_renderers/markdown_renderer.rb
decidim-decidim_awesome-0.6.2 lib/decidim/decidim_awesome/content_renderers/markdown_renderer.rb
decidim-decidim_awesome-0.6.1 lib/decidim/decidim_awesome/content_renderers/markdown_renderer.rb
decidim-decidim_awesome-0.6.0 lib/decidim/decidim_awesome/content_renderers/markdown_renderer.rb
decidim-decidim_awesome-0.5.1 lib/decidim/decidim_awesome/content_renderers/markdown_renderer.rb