Skip to content

Instantly share code, notes, and snippets.


Takahiko Ito takahi-i

View GitHub Profile
takahi-i /
Created April 8, 2017 14:42
RedPen で機種依存文字を検知するためのValidatorサンプル

機種依存文字を検知するValidator ファイル

var dependentCharacters = RegExp(/[①②③④⑤⑥⑦⑧⑨⑩⑪⑫⑬⑭⑮⑯⑰⑱⑲⑳ⅠⅡⅢⅣⅤⅥⅦⅧⅨⅩ㍉㌔㌢㍍㌘㌧㌃㌶㍑㍗㌍㌦㌣㌫㍊㌻㎜㎝㎞㎎㎏㏄㎡㍻〝〟№㏍℡㊤㊥㊦㊧㊨㈱㈲㈹㍾㍽㍼]/g);

function validateSentence(sentence) {
    var content = sentence.getContent();
    while ((match = dependentCharacters.exec(content)) != null) {
      addError("Found machine dependent character: " + "\'"+ match[0] + "\'", sentence);

RedPen plugin command have three roles

  1. install plugin
  2. test plugin
  3. uninstall plugin

command Usage



<redpen-conf lang="en">
        <validator name="SentenceLength" level="warn" >
            <property name="max_len" value="200"/>
        <validator name="InvalidSymbol" level="info" />
<redpen-conf lang="en">
        <validator name="SentenceLength" level="warn" >
            <property name="max_len" value="200"/>
        <validator name="InvalidSymbol" level="info" />
        <validator name="SpaceWithSymbol" level="error" />
        <validator name="SectionLength">

Suppress RedPen errors with annotation

Writers want to suppress errors from RedPen. In such cases, writers list up the error types they want to suppress. The list of the errors are written down to the beginning of sections or paragraphs where they want to suppress the spcified errors.

The following is a sample of AsciiDoc section which suppress two error types. In the section, the specified errors are suppressed even when RedPen detect errors.


Rule Validator

This validator checks a set of rules writers should adherre. The rules are written in the YAML format.

Format of Rules

In the rule file there are three block lang, name and pattern.



KatakanaSpecllCheck のプロパティに辞書ファイルへのパス(パスはカレントディレクトリからの相対パス)を記述する。

<redpen-conf lang="ja">
takahi-i / markdown
Last active August 29, 2015 14:20
Image of JSON with symbol setting for RedPen server
View markdown
"document": "Theyre is a blak rownd borl.",
"format": "json2",
"documentParser": "PLAIN",
"config": {
"lang" : "en",
"validators" : {
"CommaNumber": {},
"Contraction": {},
"DoubledWord": {},
takahi-i / gist:f7b75bcd8c02f9ed2ae7
Last active August 29, 2015 14:16
image of cleanup configuraiton of walter
View gist:f7b75bcd8c02f9ed2ae7

Possible Solutions

Add cleanup steps in pipeline target.

Configuration Image 1

Add cleanup as a element of a array in pipeline.