Class: HoboFields::Types::MarkdownString

Inherits:
RawMarkdownString show all
Includes:
SanitizeHtml
Defined in:
lib/hobo_fields/types/markdown_string.rb

Constant Summary collapse

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

Constants included from SanitizeHtml

SanitizeHtml::PERMITTED_ATTRIBUTES, SanitizeHtml::PERMITTED_TAGS

Constants inherited from Text

Text::COLUMN_TYPE

Instance Method Summary collapse

Methods included from SanitizeHtml

sanitize

Instance Method Details

#to_html(xmldoctype = true) ⇒ Object



20
21
22
# File 'lib/hobo_fields/types/markdown_string.rb', line 20

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