-
Notifications
You must be signed in to change notification settings - Fork 36
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Should only trim one newline at start and end so that you can add custom newlines #41
Comments
Blurgh, and then I missed you filing this issue - sorry about that @dword-design! I think this is pretty reasonable. Dedenting is a separate action from trimming. I think it'd be reasonable to stop trimming any newlines at all. Now that we have a place for options (#65), it might be good to add an option like cc @G-Rath and @Haroenv since you've been active here recently too, thoughts? |
I think dedent should definitely trim at least the first and last newline by default, otherwise it defeats the point right? I'm not sure if you need a dedicated |
I think trimming makes sense by default, but maybe when there are multiple it should be preserved? Not sure what the actual use case is that does need a non-indented string, but also has newlines that have a use case? |
Trimming one newline at begin and end and keep the others is basically what I have proposed in this PR and would be the expected behavior from my side. |
const markdown2 = `---
list: me
bird: two
---
poo
`;
const markdown = dedent`
---
list: me
bird: two
---
poo\n
`; currently i have to do this because of the trimming. maybe have an option to turn off trimming? |
Could we bring @dword-design PR back under a flag, please? This way it is not a breaking change and those who want can opt into this behaviour. |
I myself don't need it anymore since I now do it with |
@dword-design Call me peculiar, but doing it with |
@CxRes I mainly used it for a trailing newline in file-based tests and I finally decided that dedent`
# bla
blub\n
` is more compact than dedent`
# bla
blub
` But this is just my particular use case. |
\n\n @dword-design Sure, this is small potatos! I just find this funny that we should start writing like this.\n :) |
Looks like the module removes all newlines from start and end, but I think it makes more sense to only remove one newline at start and end so that I can add newlines without adding
\n
.The text was updated successfully, but these errors were encountered: