Typing text messages in Rails
What's the preferred way to handle user input with rich text in rails? Markdown looks useful, but I haven't found an editor that looks simple to customize it, and I'm not sure how to handle the html sanitization. (the helper sanitize
still seems to resolve things like </div>
which breaks my layout). I would like to ensure that the cleaned up code is valid. XHTML Strict.
a source to share
I chose TinyMCE. This allows me to sanitize the returned HTML down to tags and attributes. See the documentation for the valid_elements parameter for details.
But be careful: this sanitization feature doesn't help if someone POSTs trash directly (without a browser, like using curl). I am using Tidy with a little help from TidyFFI to prevent problems like this.
(Sorry, no links because I am not allowed to host such malware;)