Meltemi
Meltemi

Reputation: 38359

Simple Rails text field formatting

How can I easily allow blog posts (in a Rails app) to be formatted? Minimally I'd like to retain the carriage returns when text is displayed as HTML. I guess ideally it'd allow for bold, italic & indentation.

I'm aware of CKEditor. I just fear it may be overkill, and difficult to implement quickly & easily...

Upvotes: 3

Views: 3545

Answers (2)

rookieRailer
rookieRailer

Reputation: 2341

wrapping your text by simple_format(@post.description) will show line feeds in your text. For additional formatting, you will need to use gem RedCloth or likes.

Upvotes: 5

jgradim
jgradim

Reputation: 2871

Why not use Markdown? There are lots of implementations. Refer to this SO post — Better ruby markdown interpreter?

Upvotes: 3

Related Questions