summaryrefslogtreecommitdiff
path: root/autoload
diff options
context:
space:
mode:
Diffstat (limited to 'autoload')
-rw-r--r--autoload/ale/fix/registry.vim5
-rw-r--r--autoload/ale/fixers/remark_lint.vim24
2 files changed, 29 insertions, 0 deletions
diff --git a/autoload/ale/fix/registry.vim b/autoload/ale/fix/registry.vim
index 02b02699..94476ca9 100644
--- a/autoload/ale/fix/registry.vim
+++ b/autoload/ale/fix/registry.vim
@@ -365,6 +365,11 @@ let s:default_registry = {
\ 'suggested_filetypes': ['nix'],
\ 'description': 'A formatter for Nix code',
\ },
+\ 'remark-lint': {
+\ 'function': 'ale#fixers#remark_lint#Fix',
+\ 'suggested_filetypes': ['markdown'],
+\ 'description': 'Fix markdown files with remark-lint',
+\ },
\ 'html-beautify': {
\ 'function': 'ale#fixers#html_beautify#Fix',
\ 'suggested_filetypes': ['html', 'htmldjango'],
diff --git a/autoload/ale/fixers/remark_lint.vim b/autoload/ale/fixers/remark_lint.vim
new file mode 100644
index 00000000..3ce442f3
--- /dev/null
+++ b/autoload/ale/fixers/remark_lint.vim
@@ -0,0 +1,24 @@
+" Author: blyoa <blyoa110@gmail.com>
+" Description: Fixing files with remark-lint.
+
+call ale#Set('markdown_remark_lint_executable', 'remark')
+call ale#Set('markdown_remark_lint_use_global', get(g:, 'ale_use_global_executables', 0))
+call ale#Set('markdown_remark_lint_options', '')
+
+function! ale#fixers#remark_lint#GetExecutable(buffer) abort
+ return ale#node#FindExecutable(a:buffer, 'markdown_remark_lint', [
+ \ 'node_modules/remark-cli/cli.js',
+ \ 'node_modules/.bin/remark',
+ \])
+endfunction
+
+function! ale#fixers#remark_lint#Fix(buffer) abort
+ let l:executable = ale#fixers#remark_lint#GetExecutable(a:buffer)
+ let l:options = ale#Var(a:buffer, 'markdown_remark_lint_options')
+
+ return {
+ \ 'command': ale#Escape(l:executable)
+ \ . (!empty(l:options) ? ' ' . l:options : ''),
+ \}
+endfunction
+