mirror of
https://github.com/dense-analysis/ale.git
synced 2025-12-06 04:34:25 +08:00
add markdownlint fixer for markdown (#5066)
Some checks failed
CI / build_image (push) Has been cancelled
CI / test_ale (--linters-only) (push) Has been cancelled
CI / test_ale (--lua-only) (push) Has been cancelled
CI / test_ale (--neovim-07-only) (push) Has been cancelled
CI / test_ale (--neovim-08-only) (push) Has been cancelled
CI / test_ale (--vim-80-only) (push) Has been cancelled
CI / test_ale (--vim-90-only) (push) Has been cancelled
Some checks failed
CI / build_image (push) Has been cancelled
CI / test_ale (--linters-only) (push) Has been cancelled
CI / test_ale (--lua-only) (push) Has been cancelled
CI / test_ale (--neovim-07-only) (push) Has been cancelled
CI / test_ale (--neovim-08-only) (push) Has been cancelled
CI / test_ale (--vim-80-only) (push) Has been cancelled
CI / test_ale (--vim-90-only) (push) Has been cancelled
This commit is contained in:
@@ -752,6 +752,11 @@ let s:default_registry = {
|
|||||||
\ 'suggested_filetypes': ['verilog'],
|
\ 'suggested_filetypes': ['verilog'],
|
||||||
\ 'description': 'Formats verilog files using verible.',
|
\ 'description': 'Formats verilog files using verible.',
|
||||||
\ },
|
\ },
|
||||||
|
\ 'markdownlint': {
|
||||||
|
\ 'function': 'ale#fixers#markdownlint#Fix',
|
||||||
|
\ 'suggested_filetypes': ['markdown'],
|
||||||
|
\ 'description': 'Fix markdown files with markdownlint.',
|
||||||
|
\ },
|
||||||
\}
|
\}
|
||||||
|
|
||||||
" Reset the function registry to the default entries.
|
" Reset the function registry to the default entries.
|
||||||
|
|||||||
15
autoload/ale/fixers/markdownlint.vim
Normal file
15
autoload/ale/fixers/markdownlint.vim
Normal file
@@ -0,0 +1,15 @@
|
|||||||
|
:scriptencoding utf-8
|
||||||
|
|
||||||
|
call ale#Set('markdownlint_executable', 'markdownlint')
|
||||||
|
call ale#Set('markdownlint_options', '--fix')
|
||||||
|
|
||||||
|
function! ale#fixers#markdownlint#Fix(buffer) abort
|
||||||
|
let l:executable = ale#Var(a:buffer, 'markdownlint_executable')
|
||||||
|
let l:options = ale#Var(a:buffer, 'markdownlint_options')
|
||||||
|
|
||||||
|
return {
|
||||||
|
\ 'command': ale#Escape(l:executable)
|
||||||
|
\ . ' ' . l:options,
|
||||||
|
\}
|
||||||
|
endfunction
|
||||||
|
|
||||||
17
test/fixers/test_markdownlint_fixer_callback.vader
Normal file
17
test/fixers/test_markdownlint_fixer_callback.vader
Normal file
@@ -0,0 +1,17 @@
|
|||||||
|
Before:
|
||||||
|
call ale#assert#SetUpFixerTest('markdown', 'markdownlint')
|
||||||
|
|
||||||
|
After:
|
||||||
|
call ale#assert#TearDownFixerTest()
|
||||||
|
|
||||||
|
Execute:
|
||||||
|
AssertFixer {
|
||||||
|
\ 'command': ale#Escape('markdownlint') . ' --fix',
|
||||||
|
\}
|
||||||
|
|
||||||
|
Execute:
|
||||||
|
let g:ale_markdownlint_executable = 'custom_markdownlint'
|
||||||
|
|
||||||
|
AssertFixer {
|
||||||
|
\ 'command': ale#Escape('custom_markdownlint') . ' --fix',
|
||||||
|
\}
|
||||||
Reference in New Issue
Block a user