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

Preserve non-ASCII whitespaces at the end of the line and beginning of the next line #16619

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

tats-u
Copy link
Contributor

@tats-u tats-u commented Aug 28, 2024

Description

The safest part of #15081

Prettier removes non-ASCII whitespaces at the end of the line and beginning of the next line in Markdown, which violates the CommonMark spec.

The space (U+3000) in the following should be kept:

# 

 全角スペース全形空白

https://spec.commonmark.org/0.31.2/#soft-line-breaks

Spaces at the end of the line and beginning of the next line are removed:

https://spec.commonmark.org/0.31.2/#unicode-whitespace-character

A Unicode whitespace character is a character in the Unicode Zs general category, or a tab (U+0009), line feed (U+000A), form feed (U+000C), or carriage return (U+000D).

Unicode whitespace is a sequence of one or more Unicode whitespace characters.

A space is U+0020.

The CommonMark spec doesn't mention non-ASCII spaces here, so they should be reserved.

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
Copy link
Contributor Author

tats-u commented Sep 1, 2024

https://spec.commonmark.org/dingus/?text=%E3%80%80%E5%85%A8%E8%A7%92%E7%A9%BA%E7%99%BD%E3%80%80%0A

Hm, the official dingus removes such spaces.
I'll have to ask the spec maintainers a question.

@tats-u
Copy link
Contributor Author

tats-u commented Sep 1, 2024

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.

1 participant