Markup filter wanted for a public website
Developing a community site where everyone can post text, I'm looking for a markup filter:
- What is not part of the markup must be escaped (htmlspecialchars()) as it is.
- Should turn URL-s automatically into links
- Should support some form of basic markups (bold, image, url, pre, list)
- Should have a simple parser, that turns user input text into HTML
Content on the site is public to everyone, XSS must not allowed to happen.
What do you suggest? What markup language in the first place开发者_运维技巧? BBCode? Wiki? Markdown? Are there any complete API-s with good examples?
PHP is available on the server side. If there is a WYSIWYG-like texarea in addition (like here on SO) that would be a fantastic bonus!
BBCode is old and it's very verbose (pretty much HTML) but both CKEditor and TinyMCE supports it.
Wiki syntax is somewhat confusing to new users and you have to override the CamelCased words.
Markdown seems to be the de facto standard of today's web applications and StackOverflow uses it. There is a very good PHP implementation, not sure about RTEs but StackOverflow uses WYM Editor.
Also, check out the Wikipedia entry on Lightweight Markup Languages.
I think I'm going to go with BBCode via NBBC: http://nbbc.sourceforge.net/
Great list of tags supported, auto-detects complicated link, configurable, slim implementation.
精彩评论