summaryrefslogtreecommitdiff
path: root/ale_linters
diff options
context:
space:
mode:
authorrhysd <lin90162@yahoo.co.jp>2017-10-19 17:22:47 +0900
committerrhysd <lin90162@yahoo.co.jp>2017-10-19 18:17:04 +0900
commit4339af2bb6901c64ea9a104e4ed2f1589daf86aa (patch)
tree1a54581b4081a144e649d7837d2972c78b911caf /ale_linters
parent5292d2f3497604f526b05508d5891cf5d4b75c2b (diff)
downloadale-4339af2bb6901c64ea9a104e4ed2f1589daf86aa.zip
add support for remark-lint
Diffstat (limited to 'ale_linters')
-rw-r--r--ale_linters/markdown/remark_lint.vim28
1 files changed, 28 insertions, 0 deletions
diff --git a/ale_linters/markdown/remark_lint.vim b/ale_linters/markdown/remark_lint.vim
new file mode 100644
index 00000000..5b3b3d47
--- /dev/null
+++ b/ale_linters/markdown/remark_lint.vim
@@ -0,0 +1,28 @@
+" Author rhysd https://rhysd.github.io/
+" Description: remark-lint for Markdown files
+
+function! ale_linters#markdown#remark_lint#Handle(buffer, lines) abort
+ " matches: ' 1:4 warning Incorrect list-item indent: add 1 space list-item-indent remark-lint'
+ let l:pattern = '^ \+\(\d\+\):\(\d\+\) \(warning\|error\) \(.\+\)$'
+ let l:output = []
+
+ for l:match in ale#util#GetMatches(a:lines, l:pattern)
+ call add(l:output, {
+ \ 'lnum': l:match[1] + 0,
+ \ 'col': l:match[2] + 0,
+ \ 'type': l:match[3] is# 'error' ? 'E' : 'W',
+ \ 'text': l:match[4],
+ \})
+ endfor
+
+ return l:output
+endfunction
+
+call ale#linter#Define('markdown', {
+\ 'name': 'remark-lint',
+\ 'executable': 'remark',
+\ 'command': 'remark --no-stdout --no-color %s',
+\ 'callback': 'ale_linters#markdown#remark_lint#Handle',
+\ 'lint_file': 1,
+\ 'output_stream': 'stderr',
+\})