textlint rule that disallow to use NFD like 濁点.
npm install textlint-rule-no-nfdtextlint rule that disallow to use NFD like UTF8-MAC 濁点.
> ホ゜ケット
> エンシ゛ン
といったMac OS XでPDFやFinderからのコピペで問題となる濁点を見つけて、修正するtextlintルールです。
Install with npm:
npm install textlint-rule-no-nfd
Via .textlintrc(Recommended)
``json`
{
"rules": {
"no-nfd": true
}
}
Via CLI
``
textlint --rule no-nfd README.md

textlint --fix での自動修正に対応しています。
゜or \u309a
NG: ホ゜ケット
: ホ\u309aケット
OK: ポケット
゛or \u3099
NG: エンシ゛ン
: エンシ\u3099ン
OK: エンジン
See Releases page.
Install devDependencies and Run npm test:
npm i -d && npm test
2種類の濁点
以下はそれぞれ単独で存在できるVOICED SOUND MARK
- ゜\u309b\u309c
- Unicode Character 'KATAKANA-HIRAGANA VOICED SOUND MARK' (U+309B)")
- ゛
- Unicode Character 'KATAKANA-HIRAGANA SEMI-VOICED SOUND MARK' (U+309C)")
もう一つは、Combining Characterと呼ばれる結合する前提のCharacter(単独では存在できない)がある。
- \u3099 ホ\u309aケット
- e.g.) \u309a
- エンシ\u3099ン
- e.g.)
via Unicodeの特殊な文字 “結合文字列” | ものかの
これらのそれぞれをチェックし、normalizeする。
String.prototype.normalize()は、Combining Characterに対してのみ有効で、\u309b
単独で存在できる゜と゛\u309cは置換することでnormalizeする。
- String.prototype.normalize() - JavaScript | MDN
- UTF-8にもいろいろある - ザリガニが見ていた...。
- [[JavaScript]\uXXXX形式にunicodeエスケープする関数 / LiosK-free Blog](http://liosk.blog103.fc2.com/blog-entry-67.html)
- unoh.github.com by unoh
- 正規化 - odz buffer
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-featuregit commit -am 'Add some feature'
3. Commit your changes: git push origin my-new-feature`
4. Push to the branch:
5. Submit a pull request :D
MIT © azu