Support markdownlint 0.19.0 and 0.22.0

Fixes #2965
This commit is contained in:
Sebastian Blask
2020-07-30 09:51:43 +12:00
parent 5338dbf680
commit 7cada95683
2 changed files with 72 additions and 12 deletions

View File

@@ -2,15 +2,22 @@
" Description: Adds support for markdownlint
function! ale#handlers#markdownlint#Handle(buffer, lines) abort
let l:pattern=': \(\d*\): \(MD\d\{3}\)\(\/\)\([A-Za-z0-9-]\+\)\(.*\)$'
let l:pattern=': \?\(\d\+\)\(:\(\d\+\)\?\)\? \(MD\d\{3}/[A-Za-z0-9-]\+\) \(.*\)$'
let l:output=[]
for l:match in ale#util#GetMatches(a:lines, l:pattern)
call add(l:output, {
let l:result = ({
\ 'lnum': l:match[1] + 0,
\ 'text': '(' . l:match[2] . l:match[3] . l:match[4] . ')' . l:match[5],
\ 'code': l:match[4],
\ 'text': l:match[5],
\ 'type': 'W',
\})
if len(l:match[3]) > 0
let l:result.col = (l:match[3] + 0)
endif
call add(l:output, l:result)
endfor
return l:output