simple_format(text) public

Returns text transformed into HTML using simple formatting rules. Two or more consecutive newlines(\n\n) are considered as a paragraph and wrapped in <p> tags. One newline (\n) is considered as a linebreak and a <br /> tag is appended. This method does not remove the newlines from the text.


  my_text = """Here is some basic text...
            ...with a line break."""

  # => "<p>Here is some basic text...<br />...with a line break.</p>"

  more_text = """We want to put a paragraph...

              ...right there."""

  # => "<p>We want to put a paragraph...</p><p>...right there.</p>"
Show source
Register or log in to add new notes.