diff --git a/lib/html_to_markdown.rb b/lib/html_to_markdown.rb index 6a5112c8270..2bc60f6015f 100644 --- a/lib/html_to_markdown.rb +++ b/lib/html_to_markdown.rb @@ -7,7 +7,7 @@ class HtmlToMarkdown end def initialize(html) - @doc = Nokogiri::HTML.fragment(html) + @doc = Nokogiri::HTML(html) remove_whitespaces! end diff --git a/spec/components/html_to_markdown_spec.rb b/spec/components/html_to_markdown_spec.rb index f71c0e0efc4..15af2dcef34 100644 --- a/spec/components/html_to_markdown_spec.rb +++ b/spec/components/html_to_markdown_spec.rb @@ -142,6 +142,10 @@ describe HtmlToMarkdown do expect(html_to_markdown("
A list item with a blockquote:
This is a blockquote
inside a list item.
" do expect(html_to_markdown("
1st paragraph
2nd paragraph
")).to eq("1st paragraph\n\n2nd paragraph") end