From c50ba4baad90f02840cc31ee745b09078b7a1777 Mon Sep 17 00:00:00 2001 From: chefe Date: Tue, 2 Jan 2024 17:05:39 +0100 Subject: feat: add xmllint formatter (#259) * feat: add xmllint formatter * doc: shorten xmllint description --------- Co-authored-by: Steven Arcangeli <506791+stevearc@users.noreply.github.com> --- README.md | 1 + doc/conform.txt | 2 ++ lua/conform/formatters/xmllint.lua | 9 +++++++++ 3 files changed, 12 insertions(+) create mode 100644 lua/conform/formatters/xmllint.lua diff --git a/README.md b/README.md index 8171412..9001f7c 100644 --- a/README.md +++ b/README.md @@ -286,6 +286,7 @@ You can view this list in vim with `:help conform-formatters` - [uncrustify](https://github.com/uncrustify/uncrustify) - A source code beautifier for C, C++, C#, ObjectiveC, D, Java, Pawn and Vala. - [usort](https://github.com/facebook/usort) - Safe, minimal import sorting for Python projects. - [xmlformat](https://github.com/pamoller/xmlformatter) - xmlformatter is an Open Source Python package, which provides formatting of XML documents. +- [xmllint](http://xmlsoft.org/xmllint.html) - Despite the name, xmllint can be used to format XML files as well as lint them, and that's the mode this formatter is using. - [yamlfix](https://github.com/lyz-code/yamlfix) - A configurable YAML formatter that keeps comments. - [yamlfmt](https://github.com/google/yamlfmt) - yamlfmt is an extensible command line tool or library to format yaml files. - [yapf](https://github.com/google/yapf) - Yet Another Python Formatter. diff --git a/doc/conform.txt b/doc/conform.txt index f5e853d..6b963d8 100644 --- a/doc/conform.txt +++ b/doc/conform.txt @@ -326,6 +326,8 @@ FORMATTERS *conform-formatter `usort` - Safe, minimal import sorting for Python projects. `xmlformat` - xmlformatter is an Open Source Python package, which provides formatting of XML documents. +`xmllint` - Despite the name, xmllint can be used to format XML files as well as + lint them, and that's the mode this formatter is using. `yamlfix` - A configurable YAML formatter that keeps comments. `yamlfmt` - yamlfmt is an extensible command line tool or library to format yaml files. diff --git a/lua/conform/formatters/xmllint.lua b/lua/conform/formatters/xmllint.lua new file mode 100644 index 0000000..3e06400 --- /dev/null +++ b/lua/conform/formatters/xmllint.lua @@ -0,0 +1,9 @@ +---@type conform.FileFormatterConfig +return { + meta = { + url = "http://xmlsoft.org/xmllint.html", + description = "Despite the name, xmllint can be used to format XML files as well as lint them.", + }, + command = "xmllint", + args = { "--format", "-" }, +} -- cgit v1.2.3-70-g09d2