Skip to content

A platform for community discussion. Free, open, simple.

DEV: remove deprecation warnings related to Nokogiri

Loïc Guitautca978507264a
diff --git a/lib/html_to_markdown.rb b/lib/html_to_markdown.rb
index bcd0da81322..2d2783d4671 100644
--- a/lib/html_to_markdown.rb
+++ b/lib/html_to_markdown.rb
@@ -59,13 +59,13 @@ class HtmlToMarkdown
before, after = parent.children.slice_when { |n| n == br }.to_a
if before.size > 1
- b = Nokogiri::XML::Node.new(parent.name, doc.document)
+ b = doc.document.create_element(parent.name)
before[0...-1].each { |c| b.add_child(c) }
parent.previous = b if b.inner_html.present?
end
if after.present?
- a = Nokogiri::XML::Node.new(parent.name, doc.document)
+ a = doc.document.create_element(parent.name)
after.each { |c| a.add_child(c) }
parent.next = a if a.inner_html.present?
end