Skip to content
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

Remove whitespace as well when removing a node #269

Open
RheingoldRiver opened this issue Apr 25, 2021 · 1 comment
Open

Remove whitespace as well when removing a node #269

RheingoldRiver opened this issue Apr 25, 2021 · 1 comment

Comments

@RheingoldRiver
Copy link

Currently, when using code.remove(node), some whitespace (specifically new lines) is left behind, which can lead to display errors on the page in addition to extra whitespace on the source for editors to deal with.

Related: #268, #55, #265, #266

I think how it should behave (and how I've implemented it in my own tools with a workaround, see #268) is:

In the case of:

text here

{{MyTemplate}}

text here

aka, \n\n{{MyTemplate}}\n\n, after MyTemplate is removed, only \n\n should be left behind;

in the case of:

text here
{{MyTemplate}}
text here

aka, \n{{MyTemplate}}\n, after MyTemplate is removed, only one \n should be left behind;

finally, at the beginning of a document,

{{MyTemplate}}
text here

The \n should be removed;

and otherwise no whitespace is stripped.

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

No branches or pull requests

2 participants