Simple_format http://apidock.com/rails/v4.0.2/ActionView/Helpers/TextHelper/simple_formathttp:api.rubyonrails.org/classes/actionview/helpers/Texthelper.htmlmy_text="Here's some basic text...\n...with a line break."Simple_format (My_text)#= "<p>here is some basic text...\n<br/>...with a line break.</p>"Simple_format (My_text, {}, Wrapper_tag:"Div")#= "<div>here is some basic text...\n<br/>...with a line break.</div>"More_text="We want to put a paragraph...\n\n...right there."Simple_format (More_text)#= "<p>we want to put a paragraph...</p>\n\n<p>...right there.</p>"Simple_format ("Look ma! A class!",class:'Description')#= "<p class= ' description ' >look ma! A class!</p> "Simple_format ("<blink>Unblinkable.</blink>")#= "<p>Unblinkable.</p>"Simple_format ("<blink>Blinkable!</blink> It ' s true.", {}, Sanitize:false)#= "<p><blink>Blinkable!</span> It ' s true.</p>"a \ n is thought to be a newline.<br/> two \ n is considered to be segmented before it is </p> after <p>If you want to escape all content, you should invoke the H method before calling the text Helper.simple_format H ('<a href= "http://example.com/" >Example</a>')#= "<p><a href=\" http://example.com/\ "> Example</a></p> "
Rails string converted to HTML