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

Consistent handling of trailing whitespace #1481

Open
papandreou opened this issue Jul 4, 2018 · 2 comments
Open

Consistent handling of trailing whitespace #1481

papandreou opened this issue Jul 4, 2018 · 2 comments

Comments

@papandreou
Copy link
Contributor

- Do you want to request a feature or report a bug?

feature

- What is the current behavior?

Accidental trailing whitespace has a tendency of sneaking into fields when the user isn't careful, especially when pasting multiple lines of text.

Currently the string widget does not perform any trimming, if you enter foo␣␣ (where means space), it will end up like this in the front matter:

myField: 'foo  '

The markdown widget, on the other hand, removes trailing whitespace on the last line (but not the preceding lines/paragraphs), so entering foo␣␣⏎bar␣␣⏎⏎quux␣␣ will come out as:

myField: |-
  foo  \
  bar␣␣

  quux

Notice the absence of trailing whitespace after quux.

- What is the expected behavior?

That trailing whitespace is handled consistently by all widgets. To me it would be very useful if trailing whitespace on each line would be removed by both the markdown and string widgets.

It's not huge deal, but it would save me from manually sanitizing the markdown files.

@erquhart
Copy link
Contributor

Two spaces at the end of a line in markdown indicates a soft break, so we'll need to leave those, but otherwise you're right, there's no representation of trailing whitespace in a markdown AST (at least for Commonmark).

Makes sense to trim the string widgets too, but open to other opinions.

@stale
Copy link

stale bot commented Oct 29, 2019

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the status: stale label Oct 29, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants