Rails string converted to HTML

Source: Internet
Author: User

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>&lt;a href=\" http://example.com/\ "&gt; Example&lt;/a&gt;</p> "

Rails string converted to HTML

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.