From 9bb3a940389dda796192a477a016069472692526 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?George=20Guimar=C3=A3es?= Date: Tue, 31 Oct 2023 11:29:31 -0300 Subject: [PATCH] feat: add markdownlint-cli2 (#171) cli2 is a better cli for markdownlint. It allows to have config files in different directories, and it's also from the same author as the original node.js markdownlint lib. --- README.md | 2 +- doc/conform.txt | 4 +++- lua/conform/formatters/markdownlint-cli2.lua | 11 +++++++++++ 3 files changed, 15 insertions(+), 2 deletions(-) create mode 100644 lua/conform/formatters/markdownlint-cli2.lua diff --git a/README.md b/README.md index 1d169033..f8fb03d5 100644 --- a/README.md +++ b/README.md @@ -222,6 +222,7 @@ You can view this list in vim with `:help conform-formatters` - [latexindent](https://github.com/cmhughes/latexindent.pl) - A perl script for formatting LaTeX files that is generally included in major TeX distributions. - [markdown-toc](https://github.com/jonschlinkert/markdown-toc) - API and CLI for generating a markdown TOC (table of contents) for a README or any markdown files. - [markdownlint](https://github.com/DavidAnson/markdownlint) - A Node.js style checker and lint tool for Markdown/CommonMark files. +- [markdownlint-cli2](https://github.com/DavidAnson/markdownlint-cli2) - A fast, flexible, configuration-based command-line interface for linting Markdown/CommonMark files with the markdownlint library. - [mdformat](https://github.com/executablebooks/mdformat) - An opinionated Markdown formatter. - [mix](https://hexdocs.pm/mix/main/Mix.Tasks.Format.html) - Format Elixir files using the mix format command. - [nixfmt](https://github.com/serokell/nixfmt) - nixfmt is a formatter for Nix code, intended to apply a uniform style. @@ -496,7 +497,6 @@ Retrieve the available formatters for a buffer `list_all_formatters(): conform.FormatterInfo[]` \ List information about all filetype-configured formatters - ### get_formatter_info(formatter, bufnr) `get_formatter_info(formatter, bufnr): conform.FormatterInfo` \ diff --git a/doc/conform.txt b/doc/conform.txt index ae5db5ee..cbc558d9 100644 --- a/doc/conform.txt +++ b/doc/conform.txt @@ -228,7 +228,9 @@ FORMATTERS *conform-formatter `markdown-toc` - API and CLI for generating a markdown TOC (table of contents) for a README or any markdown files. `markdownlint` - A Node.js style checker and lint tool for Markdown/CommonMark - files. +`markdownlint-cli2` - A fast, flexible, configuration-based command-line + interface for linting Markdown/CommonMark files with + the markdownlint library `mdformat` - An opinionated Markdown formatter. `mix` - Format Elixir files using the mix format command. `nixfmt` - nixfmt is a formatter for Nix code, intended to apply a uniform diff --git a/lua/conform/formatters/markdownlint-cli2.lua b/lua/conform/formatters/markdownlint-cli2.lua new file mode 100644 index 00000000..69e4562b --- /dev/null +++ b/lua/conform/formatters/markdownlint-cli2.lua @@ -0,0 +1,11 @@ +---@type conform.FileFormatterConfig +return { + meta = { + url = "https://github.com/DavidAnson/markdownlint-cli2", + description = "A fast, flexible, configuration-based command-line interface for linting Markdown/CommonMark files with the markdownlint library", + }, + command = "markdownlint-cli2", + args = { "--fix", "$FILENAME" }, + exit_codes = { 0, 1 }, -- code 1 is returned when linting/formatter was successful and there were errors + stdin = false, +}