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

Allow block style in multiline scalars with trailing spaces #540

Merged
merged 2 commits into from Nov 19, 2020

Conversation

Himura2la
Copy link
Contributor

@Himura2la Himura2la commented Oct 26, 2020

We use a DocFX-based documentation system, which stores markdown in YAML. DocFX-Flavoured Markdown has a syntax for adding a <br> tag, and it looks as follows:

line before br  <!-- notice the two spaces -->
line after br

this converts to

<p>
  line before br
  <br>
  line after br
</p>

When we store it in YAML and re-serialize the value, it's being converted from

summary: >-
  line before br  

  line after br

to

summary: "line before br  \nline after br"

, which is harder to read and edit.

I see the reason why trailing spaces are disallowed in blocks (they are hard to notice, and single-line notation makes them more explicit), although I suggest you guys to review our case and compare pros and cons.
Thanks!

P.S.: I'll be grateful for the hacktoberfest-accepted label on this PR.

@Himura2la
Copy link
Contributor Author

Himura2la commented Oct 26, 2020

OK, I see it breaks three tests from yaml-test-suite:

It's strange, because the https://github.com/eemeli/yaml library is also being tested for compatibility with this suite, and passes the tests yet allowing trailing whitespaces in blocks. I guess the current implementation needs more work... And tests... I'll continue the research once I have time

@Himura2la Himura2la changed the title Allow block style in multiline scalars with trailing spaces [WIP] Allow block style in multiline scalars with trailing spaces Oct 26, 2020
@Himura2la Himura2la changed the title [WIP] Allow block style in multiline scalars with trailing spaces Allow block style in multiline scalars with trailing spaces Oct 27, 2020
@Himura2la Himura2la force-pushed the patch-1 branch 2 times, most recently from dff0dad to d3ac85e Compare October 27, 2020 11:04
@Himura2la
Copy link
Contributor Author

I hope it's ready, @aaubry, what do u think about it?

@aaubry
Copy link
Owner

aaubry commented Nov 19, 2020

Sorry for the delay. I think this is fine, since it doesn't break any test I don't see any problem with this. Thanks!

@aaubry aaubry merged commit 108c192 into aaubry:master Nov 19, 2020
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.

None yet

2 participants