Skip to content

Conversation

@soenkehahn
Copy link

I created this PR instead of opening an issue, because I thought it would be easier to describe and understand. So this is not a PR submitted for merging, but a bug report.

When endent encounters spliced in text that is indented relative to other text in the template string, it inserts indentation on any newlines that appear in the spliced in text. (Which is great!) However when the spliced in text contains two (or more) consecutive newline characters, this means that the text that endent yields contains lines that contain only spaces. As far as I can tell, this is (almost?) never the desired behavior. So I think endent should not insert indentation spaces on empty lines.

foo
${insertion}
`;
expect(output).toEqual("foo\n indented 1\n\n indented 2");

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For clarity, current behavior is

"foo\n  indented 1\n  \n  indented 2"

(note the extra two spaces between the newlines)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants