added collapseWhitespace option