We're using the HTML Styles menu to give our content editors predefined headers to use when creating pages.

In order to allow them to remove formatting they have added, I've created a paragraph option.

p.custom-stylesElement-P {

Great in theory, in practice though it causes problems. If an editor for example has a page where the markup looks like:

<p>First paragraph</p>
<p>More text</p>

If they select all that and select the paragraph style (if they added headings or other body style they no longer want), the RTE gets a bit confused about how to handle style multiple paragraphs and decides we need some extra markup. We end up with:

<p>First paragraph</p>
<p>More text</p>

After a few iteration of this, our editors are ending up with rather a lot of white space they're not expecting.

I've asked editors to just select one element at a time when making changes but this isn't ideal - is there a better way of users stripping formatting in the RTE?

1 Answer 1


This is a common issue with all wysiwyg editors.

The Telerik version also has this issue but with Spans.

The issue is due to validation rules. When the HTML doesn't validate it attempts to fix the HTML by adding in code that "Should" validate the HTML. But it rarely works and every time you edit you get an extra set of tags.

So the only real solution is to make an event receiver to strip them out.

Sorry you can't turn off validation.

  • I feared that may be the answer.
    – Ben
    Nov 13, 2012 at 17:11
  • Look on the bright side, the event receiver will take 30 minutes to get deployed right?
    – Hugh Wood
    Nov 13, 2012 at 17:12
  • I have no idea what is involved in that or even if it's possible on SharePoint Online! We've been trying to avoid anything that can't be done via SPD.
    – Ben
    Nov 13, 2012 at 17:25
  • Yes it's possible in SharePoint online. I just googled this link for you sharepoint.stackexchange.com/questions/41303/… covers the subject of event receivers, I am sure there is a markup editor one somewhere.
    – Hugh Wood
    Nov 13, 2012 at 17:32
  • Cool, I'll get one of the devs to take a peek. Will leave this open for the moment just in case anyone else has any bright ideas.
    – Ben
    Nov 14, 2012 at 11:44

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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