3
3

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

reveal.js のHTMLのスライドL内のマークダウンのJavaScriptにESLintをテキストにtextlintをVimのmakeでかける方法

Last updated at Posted at 2015-10-16

reveal.jsでhtml内でmarkdownでスライドを作っている際の

  • スライド内の文言が技評の文言表記に沿っているかどうかtextlintでチェックする
  • 「、」が4つ以上連続で一文に入っていないかtextlintでチェックする

これらをやってくれるvimのmakeコマンドを用意する。

以下をシェルで打つ。

cd ~
npm install eslint
npm install git+ssh://git@github.com/sifue/eslint-plugin-markdown.git
npm install textlint
npm install textlint-rule-max-ten
npm install textlint-rule-prh
curl -o term_rule.yaml https://raw.githubusercontent.com/azu/technical-word-rules/master/dict/web%2Bdb.yml

以下のファイルを用意する。

~/.eslintrc
{
    "rules": {
        "indent": [
            2,
            "tab"
        ],
        "quotes": [
            2,
            "single"
        ],
        "linebreak-style": [
            2,
            "unix"
        ],
        "semi": [
            2,
            "always"
        ],
        "no-console": 0,
        "no-undef" : 0,
        "no-unused-vars" : 0
    },
    "env": {
        "es6": true,
        "browser": true
    },
    "extends": "eslint:recommended",
    "plugins": [
        "markdown"
    ]
}
.textlintrc
{
  "rules": {
    "max-ten": {
      "max": 4
    },
    "prh": {
            "rulePaths" :["~/term_rule.yaml"]
    }
  }
}

最後に.vimrcの設定を追記する。

~/.vimrc
au FileType html setlocal makeprg=~/node_modules/.bin/eslint\ %;\ ~/node_modules/.bin/textlint -c\ ~/.textlintrc\ %

あとは、htmlを開いて:makeするだけでチェックしてくれるようになる。とても便利。

3
3
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
3
3

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?