textlint-rule-ja-space-between-half-and-full-width

半角文字と全角文字のスペースについてのtextlintルール

Usage no npm install needed!

<script type="module">
  import textlintRuleJaSpaceBetweenHalfAndFullWidth from 'https://cdn.skypack.dev/textlint-rule-ja-space-between-half-and-full-width';
</script>

README

textlint-rule-ja-space-between-half-and-full-width

半角文字と全角文字のスペースについてのtextlintルール

半角文字と全角文字にスペースを入れるかどうかを指定できます。

デフォルトでは、半角文字と全角文字の間にスペースを入れません。("never")

OK: これはUnicode
NG: これは Unicode

全角文字には、句読点(、。)も含まれていますがデフォルトでは、exceptPunctuation: trueであるため無視されます。

OK: これも、Unicode。

Install

Install with npm:

npm install textlint-rule-ja-space-between-half-and-full-width

Usage

Via .textlintrc(Recommended)

{
    "rules": {
        "ja-space-between-half-and-full-width": {
            "space": "never"
        }
    }
}

Via CLI

textlint --rule ja-space-between-half-and-full-width README.md

Options

  • space: "always" || "never"
    • デフォルト: "never"
    • スペースを常に 入れる("always") or 入れない("never")
  • exceptPunctuation: boolean
    • デフォルト: true
    • 句読点(、。)を例外として扱うかどうか
  • lintStyledNode: boolean
{
    "rules": {
        "ja-space-between-half-and-full-width": {
            "space": "always"
        }
    }
}

exceptPunctuation: trueとした場合は、句読点に関しては無視されるようになります。

スペースは必須だが、日本語、[alphabet]。は許可する

    text: "これは、Exception。",
    options: {
        space: "always",
        exceptPunctuation: true
    }

スペースは不要だが、日本語、 [alphabet] 。は許可する。

    text: "これは、 Exception 。",
    options: {
        space: "never",
        exceptPunctuation: true
    }

Changelog

See Releases page.

Running tests

Install devDependencies and Run npm test:

npm i -d && npm test

Contributing

Pull requests and stars are always welcome.

For bugs and feature requests, please create an issue.

  1. Fork it!
  2. Create your feature branch: git checkout -b my-new-feature
  3. Commit your changes: git commit -am 'Add some feature'
  4. Push to the branch: git push origin my-new-feature
  5. Submit a pull request :D

Author

License

MIT © azu