Move trailing whitespace functionality to a plugin