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するだけでチェックしてくれるようになる。とても便利。