2

What's the preferred way to handle rich text user input in rails? Markdown looks useful, but I haven't found an editor that looks simple to setup for it, nor am I sure how to handle sanitizing the html. (the sanitize helper still seems to allow stuff like </div>, which breaks my layout) I'd like to guarantee that the cleaned up code is valid XHTML Strict.

Eric
  • 851
  • 7
  • 16

2 Answers2

1

From this thread it appears the editor in Yahoo's UI library is a good solution. Always try the search feature first! :)

Community
  • 1
  • 1
John T
  • 23,735
  • 11
  • 56
  • 82
  • looks useful, but I've still got that sanitization problem on the generated markup, and I'm a bit wary of WYSIWYG editors for stuff like that due to the tendency for them to generate REALLY messy code – Eric May 24 '09 at 22:23
1

I chose TinyMCE. It allows me to sanitize the returned HTML code down to tags and attributes. See the documentation for the valid_elements option for details.

But beware: These sanitation feature don't help if someone POSTs rubbish directly (w/o a browser, e.g. using curl). I use Tidy with a little help by TidyFFI to prevent such troubles.

(Sorry, no links because I'm not allowed to post such kind of malware ;-)