HTML tag checker

Hi All,

I'm having a text area in my rails application as <%= f.text_area :text %>. User allowed to enter HTML tags in that text area. I'm facing following problems:

1) Not able to check whether the HTML tags entered by user are correct or not i.e how to check whether the HTML tags are properly closed or not (<>).

2) If the user copies the source code of any site and pastes it into above text field, the layout distracts.

Suggestions Appreciated........

Thanks and Regards

Saurabh Peshkar