summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ale_linters/markdown/markdownlint.vim13
-rw-r--r--doc/ale-markdown.txt11
-rw-r--r--doc/ale.txt1
-rw-r--r--test/command_callback/test_markdown_markdownlint_command_callback.vader13
4 files changed, 37 insertions, 1 deletions
diff --git a/ale_linters/markdown/markdownlint.vim b/ale_linters/markdown/markdownlint.vim
index e935cbfe..7a293938 100644
--- a/ale_linters/markdown/markdownlint.vim
+++ b/ale_linters/markdown/markdownlint.vim
@@ -1,11 +1,22 @@
" Author: Ty-Lucas Kelley <tylucaskelley@gmail.com>
" 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', {
\ 'name': 'markdownlint',
\ 'executable': 'markdownlint',
\ 'lint_file': 1,
\ 'output_stream': 'both',
-\ 'command': 'markdownlint %s',
+\ 'command': function('ale_linters#markdown#markdownlint#GetCommand'),
\ 'callback': 'ale#handlers#markdownlint#Handle'
\})
diff --git a/doc/ale-markdown.txt b/doc/ale-markdown.txt
index 4e27eb91..99848878 100644
--- a/doc/ale-markdown.txt
+++ b/doc/ale-markdown.txt
@@ -3,6 +3,17 @@ 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*
g:ale_markdown_mdl_executable *g:ale_markdown_mdl_executable*
diff --git a/doc/ale.txt b/doc/ale.txt
index ea49eedb..50c0b8a0 100644
--- a/doc/ale.txt
+++ b/doc/ale.txt
@@ -2502,6 +2502,7 @@ documented in additional help files.
luac..................................|ale-lua-luac|
luacheck..............................|ale-lua-luacheck|
markdown................................|ale-markdown-options|
+ markdownlint..........................|ale-markdown-markdownlint|
mdl...................................|ale-markdown-mdl|
prettier..............................|ale-markdown-prettier|
remark-lint...........................|ale-markdown-remark-lint|
diff --git a/test/command_callback/test_markdown_markdownlint_command_callback.vader b/test/command_callback/test_markdown_markdownlint_command_callback.vader
new file mode 100644
index 00000000..12766cfd
--- /dev/null
+++ b/test/command_callback/test_markdown_markdownlint_command_callback.vader
@@ -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'