diff options
author | w0rp <devw0rp@gmail.com> | 2016-10-24 20:40:24 +0100 |
---|---|---|
committer | w0rp <devw0rp@gmail.com> | 2016-10-24 20:40:24 +0100 |
commit | b9428b7db09d9153f85e4d57efd9559d3a024ce8 (patch) | |
tree | f54b879ed0e824e84b43a9ddc8fd7eb6de86eb23 /ale_linters/markdown | |
parent | 95373ddab5966e5975c7d1a9f52ddbbeeb664cc0 (diff) | |
download | ale-b9428b7db09d9153f85e4d57efd9559d3a024ce8.zip |
Merge #139 - Add Markdown linting support
Diffstat (limited to 'ale_linters/markdown')
-rw-r--r-- | ale_linters/markdown/mdl.vim | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/ale_linters/markdown/mdl.vim b/ale_linters/markdown/mdl.vim new file mode 100644 index 00000000..c984252e --- /dev/null +++ b/ale_linters/markdown/mdl.vim @@ -0,0 +1,35 @@ +" Author: Steve Dignam <steve@dignam.xyz> +" Description: Support for mdl, a markdown linter + +function! ale_linters#markdown#mdl#Handle(buffer, lines) abort + " matches: '(stdin):173: MD004 Unordered list style' + let l:pattern = ':\(\d*\): \(.*\)$' + let l:output = [] + + for l:line in a:lines + let l:match = matchlist(l:line, l:pattern) + + if len(l:match) == 0 + continue + endif + + call add(l:output, { + \ 'bufnr': a:buffer, + \ 'lnum': l:match[1] + 0, + \ 'vcol': 0, + \ 'col': 0, + \ 'text': l:match[2], + \ 'type': 'W', + \ 'nr': -1, + \}) + endfor + + return l:output +endfunction + +call ale#linter#Define('markdown', { +\ 'name': 'mdl', +\ 'executable': 'mdl', +\ 'command': 'mdl', +\ 'callback': 'ale_linters#markdown#mdl#Handle' +\}) |