Add options for markdown_mdl linter

This commit is contained in:
Josh Leeb-du Toit 2018-02-26 14:46:51 +11:00
parent 7ec684206c
commit 7e20d9c639
3 changed files with 34 additions and 3 deletions

View File

@ -1,5 +1,8 @@
" Author: Steve Dignam <steve@dignam.xyz> " Author: Steve Dignam <steve@dignam.xyz>, Josh Leeb-du Toit <joshleeb.com>
" Description: Support for mdl, a markdown linter " Description: Support for mdl, a markdown linter.
call ale#Set('markdown_mdl_executable', 'mdl')
call ale#Set('markdown_mdl_options', '')
function! ale_linters#markdown#mdl#Handle(buffer, lines) abort function! ale_linters#markdown#mdl#Handle(buffer, lines) abort
" matches: '(stdin):173: MD004 Unordered list style' " matches: '(stdin):173: MD004 Unordered list style'
@ -17,9 +20,17 @@ function! ale_linters#markdown#mdl#Handle(buffer, lines) abort
return l:output return l:output
endfunction endfunction
function! ale_linters#markdown#mdl#GetCommand(buffer) abort
let l:executable = ale#Var(a:buffer, 'markdown_mdl_executable')
let l:options = ale#Var(a:buffer, 'markdown_mdl_options')
return l:executable . (!empty(l:options) ? ' ' . l:options : '')
endfunction
call ale#linter#Define('markdown', { call ale#linter#Define('markdown', {
\ 'name': 'mdl', \ 'name': 'mdl',
\ 'executable': 'mdl', \ 'executable': 'mdl',
\ 'command': 'mdl', \ 'command_callback': 'ale_linters#markdown#mdl#GetCommand',
\ 'callback': 'ale_linters#markdown#mdl#Handle' \ 'callback': 'ale_linters#markdown#mdl#Handle'
\}) \})

View File

@ -2,6 +2,25 @@
ALE Markdown Integration *ale-markdown-options* ALE Markdown Integration *ale-markdown-options*
===============================================================================
mdl *ale-markdown-mdl*
g:ale_markdown_mdl_executable *g:ale_markdown_mdl_executable*
*b:ale_markdown_mdl_executable*
Type: |String|
Default: `'mdl'`
See |ale-integrations-local-executables|
g:ale_markdown_mdl_options *g:ale_markdown_mdl_options*
*b:ale_markdown_mdl_options*
Type: |String|
Default: `''`
This variable can be set to pass additional options to mdl.
=============================================================================== ===============================================================================
prettier *ale-markdown-prettier* prettier *ale-markdown-prettier*

View File

@ -136,6 +136,7 @@ CONTENTS *ale-contents*
luac................................|ale-lua-luac| luac................................|ale-lua-luac|
luacheck............................|ale-lua-luacheck| luacheck............................|ale-lua-luacheck|
markdown..............................|ale-markdown-options| markdown..............................|ale-markdown-options|
mdl.................................|ale-markdown-mdl|
prettier............................|ale-markdown-prettier| prettier............................|ale-markdown-prettier|
write-good..........................|ale-markdown-write-good| write-good..........................|ale-markdown-write-good|
nroff.................................|ale-nroff-options| nroff.................................|ale-nroff-options|