Skip to content

Commit 3f8c438

Browse files
authored
fix(space-around-link): リンクの後にスペースを強制する処理が正常に動作していない不具合を修正 (#27)
1 parent cb5b8f3 commit 3f8c438

File tree

2 files changed

+29
-1
lines changed

2 files changed

+29
-1
lines changed

packages/textlint-rule-ja-space-around-link/src/index.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ function reporter(context, options) {
5757
// InlineCodeの後に文字が存在している時のみチェック
5858
if (existAfterChar) {
5959
if (allowAfterSpace) {
60-
if (afterChar !== " " && isJapaneseChar(beforeChar)) {
60+
if (afterChar !== " " && isJapaneseChar(afterChar)) {
6161
report(
6262
node,
6363
new RuleError("リンクの後にスペースを入れてください。", {

packages/textlint-rule-ja-space-around-link/test/index-test.js

+28
Original file line numberDiff line numberDiff line change
@@ -119,6 +119,34 @@ tester.run("Link周りのスペース", rule, {
119119
},
120120
],
121121
},
122+
{
123+
text: "これは[README](./README.md)おかしい",
124+
output: "これは [README](./README.md)おかしい",
125+
options: {
126+
before: true,
127+
after: false,
128+
},
129+
errors: [
130+
{
131+
message: "リンクの前にスペースを入れてください。",
132+
column: 3,
133+
},
134+
],
135+
},
136+
{
137+
text: "これは[README](./README.md)おかしい",
138+
output: "これは[README](./README.md) おかしい",
139+
options: {
140+
before: false,
141+
after: true,
142+
},
143+
errors: [
144+
{
145+
message: "リンクの後にスペースを入れてください。",
146+
column: 25,
147+
},
148+
],
149+
},
122150
{
123151
text: "これは[README](./README.md)おかしい",
124152
output: "これは [README](./README.md) おかしい",

0 commit comments

Comments
 (0)