Sha256: 79e77250c826816d8664d3c1da94cfe3d0a09754c51d8005484b195f2869bd02

Contents?: true

Size: 550 Bytes

Versions: 5

Compression:

Stored size: 550 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
        else
          Markdown
        end

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

    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
hobo_fields-2.0.1 lib/hobo_fields/types/markdown_string.rb
hobo_fields-2.0.0 lib/hobo_fields/types/markdown_string.rb
hobo_fields-2.0.0.pre10 lib/hobo_fields/types/markdown_string.rb
hobo_fields-2.0.0.pre9 lib/hobo_fields/types/markdown_string.rb
hobo_fields-2.0.0.pre8 lib/hobo_fields/types/markdown_string.rb