views:

353

answers:

1

hi all,

i'm got a little html-wysiwyg editor in my cms and was wondering - is there a good script for tidying up html client-side? i'm mainly struggling with html that's pasted from winword. maybe some regex would help already.

thanks in advance

+2  A: 

Pasting from WORD into a WYSIWYG editor is usually a bad idea. There are editors that try to clean this up, but none of them do a perfect job. FCK editor has a strip-WORD feature, but it's not fool-proof.

WORD does some dumb things like: <bold>some <bold></bold> words</bold>, which are difficult for programs to detect and fix. You end up with all kinds of superfluous mark-up that can mess things up.

The only safe bet is to strip out ALL of the markup (i.e. make it plain text) and allow the user to fix it up in the editor.

Diodeus
Robusto