How do I make a rich text input box field like StackOverflow has?

GeekedOut picture GeekedOut · Oct 24, 2011 · Viewed 22.1k times · Source

I am working on a site that depends on user generated content, and it would be very nice to also have a way to let the users enter rich text.

How do they accomplish the rich text like they do on this site to post questions?

I understand that I can make arbitrary signs above the text area and when something is highlighted and one of the control buttons is pressed, make some jQuery call to see what is highlighted, and wrap that in some html tags like for bold text for example...and then just add the text into my database with the HTML. Is that how these kinds of rich-text things are done?

Thanks!!

Answer

Phil picture Phil · Oct 24, 2011

StackOverflow uses Markdown to format user text. Check out PageDown for an editor / preview example.

Other options that produce HTML are TinyMCE and CKEditor.