htmlbars icon indicating copy to clipboard operation
htmlbars copied to clipboard

The `chars` a TextNode inside a BlockStatement is a lie.

Open ghost opened this issue 8 years ago • 2 comments

Example:

{{#foo}}

{{/foo}}

Will report a TextNode inside the BlockStatement with chars: '\n' while this should be chars: '\n\n'. I would also accept the start location of the TextNode to be on the new line.

ghost avatar Apr 17 '16 07:04 ghost

It is actually "correct". A block statement or mustache statement will "eat" a newline if it follows directly after the mustaches.

rwjblue avatar Apr 17 '16 13:04 rwjblue

This is a default feature of the Handlebars parser. We can disable it but it is a breaking change. See https://github.com/wycats/handlebars.js/issues/1072 and https://github.com/wycats/handlebars.js/commit/ea3a5a1.

mmun avatar Apr 19 '16 00:04 mmun