See my jQuery Live Preview blog post for more details.
This is a plugin that allows you to render a preview of HTML that you allow users to write into a textarea. The plugin allows constraining the set of tags that should get rendered as HTML. All the rest get rendered as HTML encoded output.
To see the plugin in action, visit http://demo.haacked.com/livepreview/