標籤:asi 分段 san mat cal log blink format graph
simple_format http://apidock.com/rails/v4.0.2/ActionView/Helpers/TextHelper/simple_formathttp://api.rubyonrails.org/classes/ActionView/Helpers/TextHelper.htmlmy_text = "Here is 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>"一個\n被認為是換行其之後是<br/> 兩個\n被認為是分段其之前是</p>之後<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 字串 轉化為 html