Skip to content

Commit 37ad635

Browse files
committed
docs(readme): add fixable information
1 parent c807d83 commit 37ad635

File tree

3 files changed

+19
-7
lines changed

3 files changed

+19
-7
lines changed

README.md

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,11 @@
11
# textlint-rule-no-nfd [![textlint rule](https://img.shields.io/badge/textlint-fixable-green.svg?style=social)](https://textlint.github.io/)
22

3-
textlint rule that disallow to use NFD like UTF8-MAC 濁点.
3+
[textlint](https://textlint.github.io/ "textlint") rule that disallow to use NFD like UTF8-MAC 濁点.
4+
5+
> ホ゜ケット
6+
> エンシ゛ン
7+
8+
といったMac OS XでPDFやFinderからのコピペで問題となる濁点を見つけて、修正する[textlint](https://textlint.github.io/ "textlint")ルールです。
49

510
## Install
611

@@ -27,6 +32,13 @@ Via CLI
2732
textlint --rule no-nfd README.md
2833
```
2934

35+
## Fixable
36+
37+
[![textlint rule](https://img.shields.io/badge/textlint-fixable-green.svg?style=social)](https://textlint.github.io/)
38+
39+
`textlint --fix` での[自動修正](https://github.com/textlint/textlint/blob/master/docs/rule-fixer.md)に対応しています。
40+
41+
3042
## Example
3143

3244
゜or `\u309a`

src/textlint-rule-no-nfd.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,9 @@ function reporter(context) {
1818
}
1919
// \u309b\u309c => \u309a\u3099
2020
const dakutenChars = text.slice(index - 1, index + 1);
21-
const nfdlized = dakutenChars.replace("\u309B", "\u3099").replace("\u309C", "\u309A")
21+
const nfdlized = dakutenChars.replace("\u309B", "\u3099").replace("\u309C", "\u309A");
2222
const expectedText = unorm.nfc(nfdlized);
23-
const ruleError = new RuleError(`Disallow to use NFD(well-known as Mac濁点): "${dakutenChars}" => "${expectedText}"`, {
23+
const ruleError = new RuleError(`Disallow to use NFD(well-known as UTF8-MAC 濁点): "${dakutenChars}" => "${expectedText}"`, {
2424
index,
2525
fix: fixer.replaceTextRange([index - 1, index + 1], expectedText)
2626
});

test/textlint-rule-no-nfd-test.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ tester.run("no-todo", rule, {
1616
output: "ポケット",
1717
errors: [
1818
{
19-
message: `Disallow to use NFD(well-known as Mac濁点): "ホ\u309a" => "ポ"`,
19+
message: `Disallow to use NFD(well-known as UTF8-MAC 濁点): "ホ\u309a" => "ポ"`,
2020
line: 1,
2121
column: 2
2222
}
@@ -27,7 +27,7 @@ tester.run("no-todo", rule, {
2727
output: "ポケット",
2828
errors: [
2929
{
30-
message: `Disallow to use NFD(well-known as Mac濁点): "ホ\u309c" => "ポ"`,
30+
message: `Disallow to use NFD(well-known as UTF8-MAC 濁点): "ホ\u309c" => "ポ"`,
3131
line: 1,
3232
column: 2
3333
}
@@ -38,7 +38,7 @@ tester.run("no-todo", rule, {
3838
output:"エンジン",
3939
errors: [
4040
{
41-
message: `Disallow to use NFD(well-known as Mac濁点): "シ\u3099" => "ジ"`,
41+
message: `Disallow to use NFD(well-known as UTF8-MAC 濁点): "シ\u3099" => "ジ"`,
4242
line: 1,
4343
column: 4
4444
}
@@ -50,7 +50,7 @@ tester.run("no-todo", rule, {
5050
output:"エンジン",
5151
errors: [
5252
{
53-
message: `Disallow to use NFD(well-known as Mac濁点): "シ\u309b" => "ジ"`,
53+
message: `Disallow to use NFD(well-known as UTF8-MAC 濁点): "シ\u309b" => "ジ"`,
5454
line: 1,
5555
column: 4
5656
}

0 commit comments

Comments
 (0)