Class: Klaro::Client::MdText
- Inherits:
-
Object
- Object
- Klaro::Client::MdText
- Defined in:
- lib/klaro/client/support/md_text.rb
Constant Summary collapse
- SHARED_OPTIONS =
{ filter_html: true, no_links: false, no_styles: true, safe_links_only: true, with_toc_data: false }
- VARIANTS =
{ :summary => Redcarpet::Markdown.new( Redcarpet::Render::HTML.new(SHARED_OPTIONS.merge({ hard_wrap: true, })) ), :details => Redcarpet::Markdown.new( Redcarpet::Render::HTML.new(SHARED_OPTIONS.merge({ hard_wrap: false, })) ) }
Instance Method Summary collapse
-
#initialize(src, variant) ⇒ MdText
constructor
A new instance of MdText.
- #to_html ⇒ Object
- #to_s ⇒ Object
Constructor Details
Instance Method Details
#to_html ⇒ Object
35 36 37 |
# File 'lib/klaro/client/support/md_text.rb', line 35 def to_html @renderer.render(to_s).strip.gsub(/<a href/, '<a target="_blank" href') end |
#to_s ⇒ Object
31 32 33 |
# File 'lib/klaro/client/support/md_text.rb', line 31 def to_s @src end |