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

This commit is contained in:
yoan667
2025-11-22 13:16:50 +01:00
committed by GitHub
parent 962a932ed4
commit ca1da76d5e
3 changed files with 37 additions and 0 deletions

View File

@@ -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.

View 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

View 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',
\}