ActionView::Helpers::TextHelper
def simple_format(text, html_options = {}, options = {})

Description

Returns the string with a <p> for each paragraph and a <br /> for each line break.

Arguments

Changing a value updates the ERB and HTML.

Splits the string at blank lines (two or more line breaks in a row) and wraps each part in a <p>. Adds a <br /> after each single line break. If the :sanitize option is omitted, sanitizes the string before wrapping, removing tags such as <script> (<b> is kept). An empty string (or whitespace only, or nil) returns an empty <p></p>.
html_options= {}
Common options

Rails handles these options the same way in every helper. Options the HTML spec does not allow on the <p>, and ones this site considers rarely used, are not listed here.

Shared by all helpers

{active: true, hidden: false}
A hash gives the keys whose values are not false or nil, joined with spaces. An array gives its elements joined with spaces, after removing nil, false and empty strings (including whitespace-only strings).
{controller: "tags", tags_suggestions_value: ["ruby", "rails"]}
A hash adds data-* attributes, with _ in the keys converted to -. Array and hash values are converted to JSON strings.
{describedby: ["name_help", "name_error"], invalid: false}
Like :data, adds aria-* attributes. Array values are joined with spaces, leaving out nil and empty strings (nothing is added if none remain). For a hash value, the keys whose values are not false or nil are joined with spaces.
Any other html_options become HTML attributes of every <p>; those with a nil value are left out.
options= {}
"div"
Wraps each paragraph in an element with the given name instead of <p>.
false wraps the given string as is, without sanitizing it (<script> is kept too).
Other options are ignored, except :sanitize_options, which is passed to sanitize as its options.

ERB

Changes from the previous output: Added Removed Changed


          

HTML


          

Preview