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

Set prose-wrap to preserve by default #25137

Open
ryuapp opened this issue Aug 21, 2024 · 5 comments
Open

Set prose-wrap to preserve by default #25137

ryuapp opened this issue Aug 21, 2024 · 5 comments
Labels
deno fmt Related to the "deno fmt" subcommand or dprint needs discussion this topic needs further discussion to determine what action to take suggestion suggestions for new features (yet to be agreed)

Comments

@ryuapp
Copy link

ryuapp commented Aug 21, 2024

This cons may not exist in anglosphere, but a popular Japanese technology blog site (Zenn) recognizes new lines in markdown as new lines, so when markdown is formatted using deno fmt, it will break. Also, the commonly used Prettier's defaults to prose-wrap: preserve. Therefore, it is better to set prose-wrap to preserve by default.

I understand that it can be changed in the options, but I don't know the pros of setting it to always by default.

Related: #9191 prettier/prettier#6516

@dsherret
Copy link
Member

I personally prefer preserve (it's the default in dprint-plugin-markdown)

@lucacasonato
Copy link
Member

lucacasonato commented Aug 22, 2024

I don't have very strong opinions, but the pro of setting it to always is that you always linebreak at 80 columns - you don't get very long lines.

@lucacasonato lucacasonato added suggestion suggestions for new features (yet to be agreed) deno fmt Related to the "deno fmt" subcommand or dprint needs discussion this topic needs further discussion to determine what action to take labels Aug 22, 2024
@ryuapp
Copy link
Author

ryuapp commented Aug 23, 2024

I don't have very strong opinions, but the pro of setting it to always is that you always linebreak at 80 columns - you don't get very long lines.

After seeing this, I realized that the problem is that deno fmt does not support natural language formats such as Japanese and Chinese in the first place. I stated the problem there(dprint/dprint-plugin-markdown#120).

Natural languages ​​like Japanese and Chinese do not use spaces to separate text. However, English words often appear in sentences, so they are separated unnaturally.
Ref: https://en.wikipedia.org/wiki/Word_divider#Types

I don't know if deno fmt will support them in the future, but basically it is difficult to properly separate those languages text. That's why I think preserve being the default is very valuable.

@tats-u
Copy link

tats-u commented Oct 21, 2024

Ideal implementation of always for Japanese/Chinese is complex.

文文文
文文文

The above is rendered as 文文文文文文 by Firefox, and 文文文 文文文 by Chrome and Safari. (The latter is treated as a bug today but has too low priority to be fixed soon)

Moreover, there are some Markdown extension incompatible with always, for example:

:::warning
These 3 lines can be mistakenly merged into single line.
:::

The above admonition is not compatible with Prettier's always, either.
I strongly claims that preserve is the safest for Markdown. We should have changed it as of Deno v2.

@tats-u
Copy link

tats-u commented Nov 4, 2024

Prettier's default is preserve.

https://prettier.io/docs/en/options.html#prose-wrap

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
deno fmt Related to the "deno fmt" subcommand or dprint needs discussion this topic needs further discussion to determine what action to take suggestion suggestions for new features (yet to be agreed)
Projects
None yet
Development

No branches or pull requests

4 participants