I think there is already an escape_tex filter. Was it what you ment ?