I have a form for my authors to use when entering records. The form has a 'filtered text' description field that also use WYSIWYG.

I'm noticing that some of my authors enter 'bad' text. What I mean is the text they are entering looks like it's been formatted with weird spans and divs from some other text editor (probably word), so that it breaks the formatting of the record when its published.

Anyone know of a way to auto-strip extraneous html when someone inputs a record, or is it just a matter of educating them?

They really don't know anything about HTML at all so a technical solution would be best sadly.


If you're using the Filtered HTML text format, it should be stripping out spans/divs that contain inline styling. You can double check this at the /admin/config/content/formats/filtered_html path. Make sure the limit HTML tags box is checked and the Allowed HTML tags don't contain any of the HTML elements you're trying to get rid of.

enter image description here

enter image description here

If you're using the CKEditor (I'm not sure of other editors combined with the WYSIWYG module), you have a few other options to scrub bad markup when it's pasted in. You can check this by editing your Filter HTML profile under /admin/config/content/wysiwyg.

One the toolbar options contains a Paste from Word button, that allows you to paste Word-copied markup into CKEditor. I tend to avoid this myself, but you might find it useful if your users work with many Word documents.

enter image description here

My prefered option is to use the paste plugin to strip out markup altogether; going this route allows you to restrict your toolbar to HTML elements that will render correctly in both the editor & your theme. You can find this option in paste plugin tab in your WYSIWYG profile page.

enter image description here

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.