Implements #3229 - Changed multiline string literals

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