Hi,

Let's say I allow users to enter raw HTML in a web page. Let's say users are stupid and don't know how to write validate HTML. How can I clean up and simplify their code?

Examples:
Code:
<b>lorem</b><b> ipsum</b>
is simplified in
Code:
<b>lorem ipsum</b>
---
Code:
<b>lorem <i>ipsum</b> dolor</i>
is cleaned up in
Code:
<b>lorem <i>ipsum</i></b> dolor
(or something similar).

Is there any Ext JS function or plugin to do that? Or any external JS library?
I've been trying to make my own algorithm but it's not really trivial...