dprint-plugin-markdown icon indicating copy to clipboard operation
dprint-plugin-markdown copied to clipboard

Languages ​​like Japanese break each word before and after the character limit

Open ryuapp opened this issue 1 year ago • 1 comments

Languages ​​like Japanese do not use space as delimiters, so line breaks only occur when English words appears in a sentence. Sentences in such languages ​​are therefore better separated by words, regardless of white space.

Input:

Denoは、最新のWeb用のオープンソースJavaScriptランタイムです。Denoは、構成不要のTypeScript、比類のないセキュリティ、完全な組み込みツールチェーンを備えたWeb標準に基づいて構築されており、JavaScriptを使用するための最も簡単で生産的な方法です。Deno Deployは簡単にDenoのプロジェクトがデプロイ出来て便利です。

Output(deno fmt --prose-wrap always):

Denoは、最新のWeb用のオープンソースJavaScriptランタイムです。Denoは、構成不要のTypeScript、比類のないセキュリティ、完全な組み込みツールチェーンを備えたWeb標準に基づいて構築されており、JavaScriptを使用するための最も簡単で生産的な方法です。Deno
Deployは簡単にDenoのプロジェクトがデプロイ出来て便利です。

Output(npx prettier . --write --prose-wrap always)

Denoは、最新のWeb用のオープンソースJavaScriptランタイムです。Denoは、構成不要の
TypeScript、比類のないセキュリティ、完全な組み込みツールチェーンを備えたWeb標準
に基づいて構築されており、JavaScriptを使用するための最も簡単で生産的な方法で
す。Deno Deployは簡単にDenoのプロジェクトがデプロイ出来て便利です。

ryuapp avatar Aug 22 '24 15:08 ryuapp

Current Prettier's format is not compatible with Chromium & WebKit. Its behavior is going to be changed soon: https://github.com/prettier/prettier/pull/16691 https://github.com/prettier/prettier/issues/16710

The current output by Deno is the best as for now considering the behavior of each browser:

Denoは、最新のWeb用のオープンソースJavaScriptランタイムです。Denoは、構成不要のTypeScript、比類のないセキュリティ、完全な組み込みツールチェーンを備えたWeb標準に基づいて構築されており、JavaScriptを使用するための最も簡単で生産的な方法です。Deno
Deployは簡単にDenoのプロジェクトがデプロイ出来て便利です。

However, dprint can afford to append additional options unlike Prettier or Biome, so we can switch the behavior.

tats-u avatar Oct 21 '24 13:10 tats-u