module ActionText::HtmlConversion

Public Instance Methods

create_element(tag_name, attributes = {}) click to toggle source
# File lib/action_text/html_conversion.rb, line 15
def create_element(tag_name, attributes = {})
  document.create_element(tag_name, attributes)
end
fragment_for_html(html) click to toggle source
# File lib/action_text/html_conversion.rb, line 11
def fragment_for_html(html)
  document.fragment(html)
end
node_to_html(node) click to toggle source
# File lib/action_text/html_conversion.rb, line 7
def node_to_html(node)
  node.to_html(save_with: Nokogiri::XML::Node::SaveOptions::AS_HTML)
end

Private Instance Methods

document() click to toggle source
# File lib/action_text/html_conversion.rb, line 20
def document
  Nokogiri::HTML::Document.new.tap { |doc| doc.encoding = "UTF-8" }
end