Template strings do support line breaks.
`so you can
do this if you want`
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Template_literals
It does not of course prevent expansion from occurring the in the text, and by extension, code execution but maybe that’s a good thing?
Note: I don’t think there’s a way to take an existing string and run it through expression interpolation. This makes it impossible to inject code this way since the code has to originate in the source. I don’t know of an API that can do expression interpolation on-demand.
Note 2: Template strings are a ES2015 / ES6 feature. Support in every browser except (wait for it…) IE! However, Edge does support template strings.
Note 3: Template strings expand escape sequences, if you have a string inside a string that string will expand its escape sequences.
`"A\nB"`
…will result in:
"A B"
…which will not work with
JSON.parse
because there’s now a new-line in the string literal. Might be good to know.