mirror of
https://github.com/dense-analysis/ale
synced 2024-12-28 00:52:20 +00:00
Merge pull request #2940 from davidsierradz/add-markdownlint-options
allow passing custom options to markdownlint
This commit is contained in:
commit
514e5a8baa
@ -1,11 +1,22 @@
|
|||||||
" Author: Ty-Lucas Kelley <tylucaskelley@gmail.com>
|
" Author: Ty-Lucas Kelley <tylucaskelley@gmail.com>
|
||||||
" Description: Adds support for markdownlint
|
" Description: Adds support for markdownlint
|
||||||
|
|
||||||
|
call ale#Set('markdown_markdownlint_options', '')
|
||||||
|
|
||||||
|
function! ale_linters#markdown#markdownlint#GetCommand(buffer) abort
|
||||||
|
let l:executable = 'markdownlint'
|
||||||
|
|
||||||
|
let l:options = ale#Var(a:buffer, 'markdown_markdownlint_options')
|
||||||
|
|
||||||
|
return ale#Escape(l:executable)
|
||||||
|
\ . (!empty(l:options) ? ' ' . l:options : '') . ' %s'
|
||||||
|
endfunction
|
||||||
|
|
||||||
call ale#linter#Define('markdown', {
|
call ale#linter#Define('markdown', {
|
||||||
\ 'name': 'markdownlint',
|
\ 'name': 'markdownlint',
|
||||||
\ 'executable': 'markdownlint',
|
\ 'executable': 'markdownlint',
|
||||||
\ 'lint_file': 1,
|
\ 'lint_file': 1,
|
||||||
\ 'output_stream': 'both',
|
\ 'output_stream': 'both',
|
||||||
\ 'command': 'markdownlint %s',
|
\ 'command': function('ale_linters#markdown#markdownlint#GetCommand'),
|
||||||
\ 'callback': 'ale#handlers#markdownlint#Handle'
|
\ 'callback': 'ale#handlers#markdownlint#Handle'
|
||||||
\})
|
\})
|
||||||
|
@ -2,6 +2,17 @@
|
|||||||
ALE Markdown Integration *ale-markdown-options*
|
ALE Markdown Integration *ale-markdown-options*
|
||||||
|
|
||||||
|
|
||||||
|
===============================================================================
|
||||||
|
markdownlint *ale-markdown-markdownlint*
|
||||||
|
|
||||||
|
g:ale_markdown_markdownlint_options *g:ale_markdown_markdownlint_options*
|
||||||
|
*b:ale_markdown_markdownlint_options*
|
||||||
|
Type: |String|
|
||||||
|
Default: `''`
|
||||||
|
|
||||||
|
This variable can be set to pass additional options to markdownlint.
|
||||||
|
|
||||||
|
|
||||||
===============================================================================
|
===============================================================================
|
||||||
mdl *ale-markdown-mdl*
|
mdl *ale-markdown-mdl*
|
||||||
|
|
||||||
|
@ -2502,6 +2502,7 @@ documented in additional help files.
|
|||||||
luac..................................|ale-lua-luac|
|
luac..................................|ale-lua-luac|
|
||||||
luacheck..............................|ale-lua-luacheck|
|
luacheck..............................|ale-lua-luacheck|
|
||||||
markdown................................|ale-markdown-options|
|
markdown................................|ale-markdown-options|
|
||||||
|
markdownlint..........................|ale-markdown-markdownlint|
|
||||||
mdl...................................|ale-markdown-mdl|
|
mdl...................................|ale-markdown-mdl|
|
||||||
prettier..............................|ale-markdown-prettier|
|
prettier..............................|ale-markdown-prettier|
|
||||||
remark-lint...........................|ale-markdown-remark-lint|
|
remark-lint...........................|ale-markdown-remark-lint|
|
||||||
|
@ -0,0 +1,13 @@
|
|||||||
|
Before:
|
||||||
|
call ale#assert#SetUpLinterTest('markdown', 'markdownlint')
|
||||||
|
|
||||||
|
After:
|
||||||
|
call ale#assert#TearDownLinterTest()
|
||||||
|
|
||||||
|
Execute(The default command should be correct):
|
||||||
|
AssertLinter 'markdownlint', ale#Escape('markdownlint') . ' %s'
|
||||||
|
|
||||||
|
Execute(The options should be configurable):
|
||||||
|
let g:ale_markdown_markdownlint_options = '--config ~/custom/.markdownlintrc'
|
||||||
|
|
||||||
|
AssertLinter 'markdownlint', ale#Escape('markdownlint') . ' --config ~/custom/.markdownlintrc %s'
|
Loading…
Reference in New Issue
Block a user