Reputation: 4866
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?
Upvotes: 0
Views: 214
Reputation: 4600
I personally think that it is better to allow normal html tags. Yet another markup with its own little variations is less usable.
Jakob's Law of the Web User Experience states that:
"users spend most of their time on other websites."
So you need to do it like most other sites do.
That leaves you with:
Upvotes: 3
Reputation: 2494
Not sure if this fits your needs, but check out fckeditor, or tinymce.
Upvotes: 0