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

[editorconfig] Turn off trim_trailing_whitespace in Markdown in root or changelog_unreleased #11605

Merged
merged 1 commit into from Oct 6, 2021

Conversation

tats-u
Copy link
Contributor

@tats-u tats-u commented Oct 2, 2021

Description

When EditorConfig is enabled in your text editor, you cannot use line breaking by adding two whitespaces at the end of lines in Markdown files in the project root or changelog_unreleased.

Checklist

  • I’ve added tests to confirm my change works.
  • (If changing the API or CLI) I’ve documented the changes I’ve made (in the docs/ directory).
  • (If the change is user-facing) I’ve added my changes to changelog_unreleased/*/XXXX.md file following changelog_unreleased/TEMPLATE.md.
  • I’ve read the contributing guidelines.

Try the playground for this PR

@tats-u tats-u changed the title [editorconfig] Disable trim_trailing_whitespace in Markdown in root or changelog_unreleased [editorconfig] Turn off trim_trailing_whitespace in Markdown in root or changelog_unreleased Oct 2, 2021
.editorconfig Outdated
@@ -18,5 +18,8 @@ trim_trailing_whitespace = false
[tests/{**/__snapshots__/*, tests/format/**/*}]
trim_trailing_whitespace = false

[{*,changelog_unreleased/**}.md]
Copy link
Member

Choose a reason for hiding this comment

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

Can you concat with the config for [website/blog/*.md]?

Copy link
Contributor Author

@tats-u tats-u Oct 5, 2021

Choose a reason for hiding this comment

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

@sosukesuzuki I have done. It seems to still work well.

PS> yarn editorconfig .\changelog_unreleased\markdown\.gitkeep
yarn run v1.22.4
$ I:\prettier\node_modules\.bin\editorconfig .\changelog_unreleased\markdown\.gitkeep
charset=utf-8
indent_style=space
indent_size=2
trim_trailing_whitespace=true
end_of_line=lf
insert_final_newline=true
tab_width=2
Done in 0.15s.

PS> yarn editorconfig .\changelog_unreleased\markdown\.gitkeep.md
yarn run v1.22.4
$ I:\prettier\node_modules\.bin\editorconfig .\changelog_unreleased\markdown\.gitkeep.md
charset=utf-8
indent_style=space
indent_size=2
trim_trailing_whitespace=false
end_of_line=lf
insert_final_newline=true
tab_width=2
Done in 0.14s.

PS> yarn editorconfig .\changelog_unreleased\BLOG_POST_INTRO_TEMPLATE.md
yarn run v1.22.4
$ I:\prettier\node_modules\.bin\editorconfig .\changelog_unreleased\BLOG_POST_INTRO_TEMPLATE.md
charset=utf-8
indent_style=space
indent_size=2
trim_trailing_whitespace=false
end_of_line=lf
insert_final_newline=true
tab_width=2
Done in 0.15s.

PS> yarn editorconfig .\changelog_unreleased\BL
yarn run v1.22.4
$ I:\prettier\node_modules\.bin\editorconfig .\changelog_unreleased\BL
charset=utf-8
indent_style=space
indent_size=2
trim_trailing_whitespace=true
end_of_line=lf
insert_final_newline=true
tab_width=2
Done in 0.15s.

PS> yarn editorconfig .\README.md
yarn run v1.22.4
$ I:\prettier\node_modules\.bin\editorconfig .\README.md
charset=utf-8
indent_style=space
indent_size=2
trim_trailing_whitespace=false
end_of_line=lf
insert_final_newline=true
tab_width=2
Done in 0.18s.

PS> yarn editorconfig .\src\foobarbaz.md
yarn run v1.22.4
$ I:\prettier\node_modules\.bin\editorconfig .\src\foobarbaz.md
charset=utf-8
indent_style=space
indent_size=2
trim_trailing_whitespace=true
end_of_line=lf
insert_final_newline=true
tab_width=2
Done in 0.15s.

@sosukesuzuki sosukesuzuki merged commit 5808270 into prettier:main Oct 6, 2021
@tats-u tats-u deleted the editorconfig-md branch October 6, 2021 05:24
@fisker
Copy link
Member

fisker commented Oct 7, 2021

I don't understand why we need this change.

@tats-u
Copy link
Contributor Author

tats-u commented Oct 10, 2021

@fisker
I would like to add paragraphs like the following to a changelog for #11597. As you know, Markdown allows trailing 2 spaces and convert them to single <br />. I do not understand why we ban a specific specification in Markdown.

In Foo, Bar should not be Baz.

> Quotation. Quotation. Quotation.
>
> Quotation. Quotation. Quotation.

<https://a.source.example.com/>  
<https://b.source.example.com/>  
<https://c.source.example.com/>

Without this, I have to insert empty lines between URLs or use a list.

@tats-u
Copy link
Contributor Author

tats-u commented Oct 10, 2021

I would like to cherry-pick this commit into#11597. Is this allowed?

@sosukesuzuki
Copy link
Member

@tats-u I've merged main into next. Can you rebase latest next into #11597 ?

@sosukesuzuki
Copy link
Member

I mistook something, Actions for next failed... I'll fix.

@tats-u
Copy link
Contributor Author

tats-u commented Oct 10, 2021

@sosukesuzuki I will wait until Actions succeeds.

@fisker
Copy link
Member

fisker commented Oct 12, 2021

Markdown allows trailing 2 spaces and convert them to single
. I do not understand why we ban a specific specification in Markdown.

You may consider it's bug in Prettier, but this PR doesn't make sense, we keep trim_trailing_whitespace in editorconfig, but we still format these files by Prettier, the space will be moved again.

@fisker
Copy link
Member

fisker commented Oct 12, 2021

The only need in changelog_unreleased files is wrote some example code, but we can do something like

```markdown
foo<SPACE><SPACE>
```

Other cases we can use <br> or \

@fisker
Copy link
Member

fisker commented Oct 12, 2021

@sosukesuzuki ^

@tats-u
Copy link
Contributor Author

tats-u commented Oct 12, 2021

@fisker

You may consider it's bug in Prettier, but this PR doesn't make sense, we keep trim_trailing_whitespace in editorconfig, but we still format these files by Prettier, the space will be moved again.

I am afraid that this is new to me. I would like you to check out the following sandbox showing that trailing 2 spaces are not deformed in the latest stable version of Prettier even when --prose-wrap is always.

https://prettier.io/playground/#N4Igxg9gdgLgprEAuEBiABAFTgZxgHSkIBkIAnOAW3QEsAHHAV2oBMIAbc9HGmdAQ0pwYAGnSQoOOGHgxGZAS3o0cYGlADm6OO15ipLdG201GOShEPxKdLurVKWjWOkZ92-AEbk42vm04KdEp+DSh+AV0AR0Z+ADp0AFU+BBpqfkNKdTT0ADdUwTEYlXQoCDwyRkM4AA84MjUYfhgaaFd2D0pIdA9vMhKoFRpXPn5oxnptGu0IyEoLYwkpGOaEgBEJnAE3XxpKoIC7KHQKOgoACwQWet5aY9yORjom+DydW9wpcRoO5iMOHzaRjoABmjA0NGapUYHQidH4-Wa8gSAFEamA4M84PJuOo+BAwGB+NIoWAnjQWM0oWVjmcIBSEKJuM4+OpxDD4ehiugICCQTQ1BFrlJKi4LB1bvxBtQKdo8D0vORmHFCIQADznGAwBhIAD0uo0EAgcQ07AAfOh0OrNdqcHqDUaTebLdatTr9YbjaazaqoIBEwnQMDI-B+6i0ACZuPCMVtahjnoHLgr5YkAErEX0at12j2O72u232z1On1QLOF3Ne82+gNlQPB0OaKP8GMgEQgCDPVqSZCgBFkCAAdwACgiEDhkCAxoP+ABPCftzzBsAAa2EAGVBHBiOo4MgQWMpIvl2uYOvo2HkEHGHB21RPHAWNcWMQpRpYho4AAxcghLWXlB+DcCA2xATVKHYAB1c5eFwaM4HXcdeBoXJeFnScwBwBcQHUEUYGHYMNBCfdD1vEAACscBqdcw3YOAAEVGAgeASPYI8QHhMgRUnEIyBXNhBygUCzjxSCKRgc5kAADgABnbOkpEg4M6Enac52wmJmLgAjOwnQCcAAWigOBH0fUCKGKCgCNCYikAPNiyKkLIr0qRzaIYpiWLs0j2yaTwxJYCTkHDXyG10TQAGEIHmfhJ1wABWUCzDgTAvD0+z2NyG8AEkoGuWB1zAfpngAQTy9cYFnOjWKkABfWqgA

Also, there seem to be no .prettierrc mentioning the configuration for Markdown or --prose-wrap.

@fisker
Copy link
Member

fisker commented Oct 12, 2021

@tats-u turns out I got confused by #6793, I thought markdown remove that too.... I'm sorry.

@tats-u
Copy link
Contributor Author

tats-u commented Oct 16, 2021

@fisker You had me worried. I am relieved that it turned out to be just your misunderstanding.

@tats-u
Copy link
Contributor Author

tats-u commented Oct 17, 2021

@sosukesuzuki I did it because I confirmed that the CI of fa59637 passed.

@sosukesuzuki
Copy link
Member

@tats-u Ah sorry, I forgot to say you that.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Oct 18, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants