[v] [Rails] simple_format

simple_format(text, html_options = {}, options = {})

Returns text transformed into HTML using simple formatting rules. Two or more consecutive newlines(\n\n) are considered as a paragraph and wrapped in

tags. One newline (\n) is considered as a linebreak and a
tag is appended. This method does not remove the newlines from the text.

比如說我們在表單欄位中輸入

1st line of 1st post
2nd line
3rd line

2nd paragraph

代碼是 <%= post.content %>

結果是

代碼是 <%= simple_format(post.content) %>

結果是

很明顯能看出差別