Module: ContentBlockTools::Govspeak

Included in:
Presenters::BlockPresenters::BasePresenter, Presenters::ContactPresenter
Defined in:
lib/content_block_tools/helpers/govspeak.rb

Instance Method Summary collapse

Instance Method Details

#render_govspeak(body, root_class: nil) ⇒ Object



3
4
5
6
7
8
# File 'lib/content_block_tools/helpers/govspeak.rb', line 3

def render_govspeak(body, root_class: nil)
  html = ::Govspeak::Document.new(body).to_html
  Nokogiri::HTML.fragment(html).tap { |fragment|
    fragment.children[0].add_class(root_class) if root_class
  }.to_s.html_safe
end