Implements #3229 - Changed multiline string literals

Implements #3229. Please scrutinize. `trimAndEscapeLines` might not be the best method name under the sun. All feedback welcome.