mirror of
https://github.com/dense-analysis/ale.git
synced 2025-12-08 05:24:46 +08:00
Markdown: allow passing custom executable for markdownlint (#4358)
This commit is contained in:
@@ -1,10 +1,15 @@
|
|||||||
" 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_executable', 'markdownlint')
|
||||||
call ale#Set('markdown_markdownlint_options', '')
|
call ale#Set('markdown_markdownlint_options', '')
|
||||||
|
|
||||||
|
function! ale_linters#markdown#markdownlint#GetExecutable(buffer) abort
|
||||||
|
return ale#Var(a:buffer, 'markdown_markdownlint_executable')
|
||||||
|
endfunction
|
||||||
|
|
||||||
function! ale_linters#markdown#markdownlint#GetCommand(buffer) abort
|
function! ale_linters#markdown#markdownlint#GetCommand(buffer) abort
|
||||||
let l:executable = 'markdownlint'
|
let l:executable = ale_linters#markdown#markdownlint#GetExecutable(a:buffer)
|
||||||
|
|
||||||
let l:options = ale#Var(a:buffer, 'markdown_markdownlint_options')
|
let l:options = ale#Var(a:buffer, 'markdown_markdownlint_options')
|
||||||
|
|
||||||
@@ -14,7 +19,7 @@ endfunction
|
|||||||
|
|
||||||
call ale#linter#Define('markdown', {
|
call ale#linter#Define('markdown', {
|
||||||
\ 'name': 'markdownlint',
|
\ 'name': 'markdownlint',
|
||||||
\ 'executable': 'markdownlint',
|
\ 'executable': function('ale_linters#markdown#markdownlint#GetExecutable'),
|
||||||
\ 'lint_file': 1,
|
\ 'lint_file': 1,
|
||||||
\ 'output_stream': 'both',
|
\ 'output_stream': 'both',
|
||||||
\ 'command': function('ale_linters#markdown#markdownlint#GetCommand'),
|
\ 'command': function('ale_linters#markdown#markdownlint#GetCommand'),
|
||||||
|
|||||||
@@ -17,6 +17,15 @@ See |ale-dprint-options| and https://dprint.dev/plugins/markdown
|
|||||||
===============================================================================
|
===============================================================================
|
||||||
markdownlint *ale-markdown-markdownlint*
|
markdownlint *ale-markdown-markdownlint*
|
||||||
|
|
||||||
|
g:ale_markdown_markdown_executable *g:ale_markdown_markdownlint_executable*
|
||||||
|
*b:ale_markdown_markdownlint_executable*
|
||||||
|
Type: |String|
|
||||||
|
Default: `'markdownlint'`
|
||||||
|
|
||||||
|
Override the invoked markdownlint binary. You can use other binaries such as
|
||||||
|
markdownlint-cli2.
|
||||||
|
|
||||||
|
|
||||||
g:ale_markdown_markdownlint_options *g:ale_markdown_markdownlint_options*
|
g:ale_markdown_markdownlint_options *g:ale_markdown_markdownlint_options*
|
||||||
*b:ale_markdown_markdownlint_options*
|
*b:ale_markdown_markdownlint_options*
|
||||||
Type: |String|
|
Type: |String|
|
||||||
|
|||||||
@@ -7,6 +7,11 @@ After:
|
|||||||
Execute(The default command should be correct):
|
Execute(The default command should be correct):
|
||||||
AssertLinter 'markdownlint', ale#Escape('markdownlint') . ' %s'
|
AssertLinter 'markdownlint', ale#Escape('markdownlint') . ' %s'
|
||||||
|
|
||||||
|
Execute(The executable should be configurable):
|
||||||
|
let g:ale_markdown_markdownlint_executable = 'foo bar'
|
||||||
|
|
||||||
|
AssertLinter 'foo bar', ale#Escape('foo bar') . ' %s'
|
||||||
|
|
||||||
Execute(The options should be configurable):
|
Execute(The options should be configurable):
|
||||||
let g:ale_markdown_markdownlint_options = '--config ~/custom/.markdownlintrc'
|
let g:ale_markdown_markdownlint_options = '--config ~/custom/.markdownlintrc'
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user