So, based on the Ambush-comander suggestion , I was able to remove all the gaps that did not have a particular class, the idea is that if the class that it required, the element does not have this class, the element will be deleted.
I did some research and found htmlpurifier customize that explains how to add an attribute according to their instructions. I only need to add four lines of code so this is how I did it
// more configuration stuff up here $config->set('HTML.DefinitionID', 'enduser-customize.html editor'); $config->set('HTML.DefinitionRev', 1); $def = $config->getHTMLDefinition(true); $def->addAttribute('span', 'class*', new HTMLPurifier_AttrDef_Enum( array('allowed') )); // purify down here
* in the class makes the class requried and becuse we allow only the permitted class everything else striped. now there is one caveat to do it this way. if someone puts this class in this place then it will be allowed in my case. I do not use "permitted". I am using something else that will be replaced by html purifier
hth someone else
and thanks to the ambush and the pink for all their help!
source share