You can use a function as a rule in the attribute map

It takes one argument (attribs) and must return a new object populated
with attributes (keys) and their values. These values will still get
checked for naughtHrefs
Added 'contentFunction's allowing you to run a function on the content of a tag

These will give you more control over your sanitization. The case I had
in mind was the automatic insertion of <code> tags in a <pre> block if
you wanted that sort of functionality (the possibilities are endless,
though). You simply add a function under the key of the tag you want to
be executed in the contentFunctions key of the options (just like you
would with allowedAttributes), and that function takes two arguments
(content, attribs) which will then return the new content.
If you do not desire an tag to have content functions executed inside
it, simply add that tag to the disallowedContentFunctions array in the
options.