Skip to content

Add custom textlint rules under textfile dir #98

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 6 commits into from
Feb 11, 2019
Merged

Add custom textlint rules under textfile dir #98

merged 6 commits into from
Feb 11, 2019

Conversation

smikitky
Copy link
Member

@smikitky smikitky commented Feb 8, 2019

Textlint can load rule files specified via the --rulesdir option, so this should be the easiest way to check something within source markdown file.


スペースにまつわる問題を検出できる textlint ルールを追加し、ローカルの textlint ディレクトリに置きました。

  • 句読点の後に半角スペースがある場合にエラーになります。…です。 React は…
  • 全角文字と半角英数字との間に半角スペースがない場合にエラーになります。
  • 全角疑問符・感嘆符の直後に置けるスペースを半角で統一します。(これまでの textlint は「?」「!」直後のスペースを全角としていました)
  • 行末にスペースがある場合にエラーになります(未翻訳の原文にもこのエラーがいくつかあるため、現時点では日本語の含まれた行のみを対象としています)

既存の翻訳に見られていたエラーについても(手作業で)一掃し、現時点で怪しげな過剰検出がなかったことを確認しました。

既知の制限:

  • 自動フィックス(--fix)はできません。
  • 問題のある行番号は正しく表示できますが、文字位置(桁)を表示できません。これは要素間のスペースの問題を正規表現でさくっと検出するために段落を一旦プレーンテキストに変換する処理を挟んだ関係で、正しいマークアップ上での位置情報が失われているためです。

@smikitky smikitky changed the title WIP: Add custom textlint rules under textfile dir Add custom textlint rules under textfile dir Feb 8, 2019
@smikitky smikitky requested review from koba04 and potato4d February 8, 2019 18:50
@smikitky
Copy link
Member Author

smikitky commented Feb 8, 2019

@potato4d @koba04 レビューお願いします。これでだいぶ楽になる(特に翻訳者の負担が軽減される)と思います。

Copy link
Member

@koba04 koba04 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍 ありがとうございます!いいと思います!

Copy link
Member

@potato4d potato4d left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

良さそうです!ありがとうございます!

@smikitky smikitky merged commit 964304d into master Feb 11, 2019
@smikitky smikitky mentioned this pull request Feb 11, 2019
90 tasks
@smikitky smikitky deleted the textlint branch February 11, 2019 06:26
@smikitky smikitky added the workflow Working environment improvements including linting and CSS styles label Feb 13, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
workflow Working environment improvements including linting and CSS styles
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants