Sha256: 3a7f9a8ecedc618fc8d130d1b13331016a90eb1209474ebe6decc6242721153b

Contents?: true

Size: 569 Bytes

Versions: 14

Compression:

Stored size: 569 Bytes

Contents

module HoboFields
  module Types
    class MarkdownString < RawMarkdownString

      include SanitizeHtml

      HoboFields.register_type(:markdown, self)

      @@markdown_class = case
        when defined?(RDiscount)
          RDiscount
        when defined?(Kramdown)
          Kramdown::Document
        when defined?(Maruku)
          Maruku
        when defined?(Markdown)
          Markdown
        end

      def to_html(xmldoctype = true)
        blank? ? "" : HoboFields::SanitizeHtml.sanitize(@@markdown_class.new(self).to_html)
      end

    end
  end
end

Version data entries

14 entries across 14 versions & 1 rubygems

Version Path
hobo_fields-2.2.6 lib/hobo_fields/types/markdown_string.rb
hobo_fields-2.2.5 lib/hobo_fields/types/markdown_string.rb
hobo_fields-2.2.4 lib/hobo_fields/types/markdown_string.rb
hobo_fields-2.2.3 lib/hobo_fields/types/markdown_string.rb
hobo_fields-2.2.2 lib/hobo_fields/types/markdown_string.rb
hobo_fields-2.2.1 lib/hobo_fields/types/markdown_string.rb
hobo_fields-2.2.0 lib/hobo_fields/types/markdown_string.rb
hobo_fields-2.1.2 lib/hobo_fields/types/markdown_string.rb
hobo_fields-2.1.1 lib/hobo_fields/types/markdown_string.rb
hobo_fields-2.1.0 lib/hobo_fields/types/markdown_string.rb
hobo_fields-2.1.0.pre4 lib/hobo_fields/types/markdown_string.rb
hobo_fields-2.1.0.pre3 lib/hobo_fields/types/markdown_string.rb
hobo_fields-2.1.0.pre2 lib/hobo_fields/types/markdown_string.rb
hobo_fields-2.1.0.pre1 lib/hobo_fields/types/markdown_string.rb