Formats Wordpress 'post' content in Ruby: Replaces double line breaks with paragraph elements.
Same as Wordpress' wpautop() function
gem install auto_paragraphrequire 'auto_paragraph'
input_text = "text from database\nwith carriage returns\n instead of paragraph tags.\n\nNew paragraph."
autop = AutoParagraph.new(insert_line_breaks: true)
formatted_text = autop.execute(input_text)
puts formatted_text
# <p>text from database<br />
# with carriage returns<br />
# instead of paragraph tags.</p>
# <p>New paragraph.</p>The AutoParagraph design was copied from the php code for Wordpress 4.3, then ruby-ized.
Copyright © 2016 David Peterson See LICENSE.txt for details.