I am working on a website in PHP where people can make comments similar to a blog, and I only want particular tags to be allowed. Are there any pre-built libraries that process comments and produce valid XHTML Strict code? I would need to do this in JavaScript so I can generate a live preview like Stack Overflow, plus in PHP before saving it to a MySQL database.
The allowed HTML tags will be: strong, em, blockquote, and links (rel=nofollow not required)
One way would be to allow people to directly enter the HTML into the comment field but I would prefer to use a simple mark up something like this (can be different - this is an example):
*strong*
_em_
[blockquote]
http://www.link.com
I want line breaks to be converted to <br />
.
Are there any code libraries that do the above?