Sha256: 5c1a2b3410552caaa7495debe56700ac539aefd4d60159bda13fcda95f8d2f04

Contents?: true

Size: 667 Bytes

Versions: 9

Compression:

Stored size: 667 Bytes

Contents

require 'redcarpet'

module Thredded
  module Filter
    module Markdown
      def self.included(base)
        base.class_eval do
          Thredded::Post::Filters << :markdown
        end
      end

      def filtered_content
        if filter.to_sym == :markdown
          renderer = Redcarpet::Render::HTML.new(hard_wrap: true, filter_html: true)
          markdown = Redcarpet::Markdown.new(renderer, autolink: true,
            space_after_headers: true, no_intraemphasis: true,
            fenced_code: true, gh_blockcode: true)
          @filtered_content = markdown.render(super).html_safe
        else
          super
        end
      end
    end
  end
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
thredded-0.0.10 lib/thredded/filter/markdown.rb
thredded-0.0.9 lib/thredded/filter/markdown.rb
thredded-0.0.8 lib/thredded/filter/markdown.rb
thredded-0.0.7 lib/thredded/filter/markdown.rb
thredded-0.0.6 lib/thredded/filter/markdown.rb
thredded-0.0.5 lib/thredded/filter/markdown.rb
thredded-0.0.4 lib/thredded/filter/markdown.rb
thredded-0.0.3 lib/thredded/filter/markdown.rb
thredded-0.0.1 lib/thredded/filter/markdown.rb