Escape newlines in heredocs with backslashes
Merge pull request #3256 from xixixao/issue3249

 Implements #3249, #1994 Escape newlines in heredocs with backslashes