How to trim content AND retain HTML?

How to trim content AND retain HTML?