textlint-ja / textlint-rule-preset-ja-spacing

スペース周りのスタイルを扱うtextlintルールプリセット
https://textlint-ja.github.io/textlint-rule-preset-ja-spacing/
MIT License
72 stars 14 forks source link

半角文字と全角文字にスペースを入れるかどうかのルールで、数字のみ無効にする設定が欲しい #40

Closed uhooi closed 1 year ago

uhooi commented 2 years ago

textlint-rule-ja-space-between-half-and-full-width ルールは、デフォルトでアルファベットと数字の両方に適用されます。 https://github.com/textlint-ja/textlint-rule-preset-ja-spacing/tree/master/packages/textlint-rule-ja-space-between-half-and-full-width

アルファベットのみ適用し、数字は無視する設定が欲しいです。

適用前

## テスト

2022年7月7日、本日は晴天なり。
りんごは英語でAppleという。

適用後

## テスト

2022年7月7日、本日は晴天なり。
りんごは英語で Apple という。

このように「2022年7月7日」はそのままで、「Apple」の前後のみに半角スペースを入れたいです。

Sean0628 commented 1 year ago

オプションにスペースを入れる対象の配列を指定できるようになりました。

Refs: v2.3.0

{
    "rules": {
        "ja-space-between-half-and-full-width": {
            "space": ["alphabets"]
        }
    }
}
>>> cat old.md
## テスト

2022年7月7日、本日は晴天なり。
りんごは英語でAppleという。

>>> cat old.md | npx textlint --stdin --stdin-filename README.md --fix --format fixed-result --output-file new.md

>>> cat new.md
## テスト

2022年7月7日、本日は晴天なり。
りんごは英語で Apple という。
uhooi commented 1 year ago

なんと…!?ご対応ありがとうございます、嬉しいです🙇