iansan5653 / compress-tag

:abcd: Template literal tag for painless multiline strings in JS.
https://www.npmjs.com/compress-tag
MIT License
14 stars 2 forks source link

Enable the manual preservation of newlines when using as wrappers #4

Closed iansan5653 closed 3 years ago

iansan5653 commented 5 years ago

Currently, the following are treated the same when using the tags as wrappers instead of as template tags:

`This is a
test string.`
`This is a \ntest string.`

Previously, the workaround was to double escape the character, like so:

`This is a \\ntest string.`

However this causes problems with URIs:

`C:\\folder\\newfolder`

I'm open to other ideas. The reason it's possible with the normal tags is because the template literal tags have access to the .raw property of the passed string array, which allows the code to manually handle escape characters.