squirrellyjs / squirrelly

Semi-embedded JS template engine that supports helpers, filters, partials, and template inheritance. 4KB minzipped, written in TypeScript ⛺
https://squirrelly.js.org
MIT License
555 stars 81 forks source link

Newline inconsistency between linux and windows #255

Open sowhatdoido opened 1 year ago

sowhatdoido commented 1 year ago

Describe the bug Looping through a list renders newlines inconsistently between linux and windows. Specifically, windows seems to add extra newline after every row, when linux doesn't.

To Reproduce Use the following to print a list of keypair values: image

On Linux:

KEY1=VALUE1KEY2=VALUE2

On Windows:


KEY1=VALUE1

KEY2=VALUE2

Expected behavior Expectation is that rendering newline characters regardless of environment.

Package & Environment Details

Additional context I think windows is the problem here. If I copy the example from your REPL exactly (note the newlines before and after what's being printed):

{{@foreach(it) => key, val}}

{{key}}={{val}}

{{/foreach}}

I get an output that yields:


KEY1=VALUE1

KEY2=VALUE2

There is a bunch of unexpected whitespace when compared to this: image