set up function to apply a text transformation but preserve poweruser protected markups