Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
How to use the Loofah library with a Nokogiri node to preserve line breaks between block elements
npage = Nokogiri::HTML(html)
h[:text] = Loofah.fragment(npage.search('.displaytext').to_html).to_text
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment