开发者

Show <br/> in <p>

开发者 https://www.devze.com 2023-03-11 05:28 出处:网络
i replaced line feed characters with HTML line break as @post.description.gsub(/\\n/, \"<br/>\")

i replaced line feed characters with HTML line break as

@post.description.gsub(/\n/, "<br/>")

I am trying to show the output w开发者_JAVA百科ithin

tags. But I see as follows:

Used, like new book<br/>New book costs $150<br/>Awesome book!

Need help. Thanks.


Use simple_format for this as it will automatically convert new lines into breaks.

<%= simple_format(@post.description) %>
0

精彩评论

暂无评论...
验证码 换一张
取 消