aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorchefe <chefe@users.noreply.github.com>2024-01-02 17:05:39 +0100
committerGitHub <noreply@github.com>2024-01-02 08:05:39 -0800
commitc50ba4baad90f02840cc31ee745b09078b7a1777 (patch)
tree7c1e3907cfa906baed0c5520ef7d64f1ec38d13d
parentad2b5ecd907128ed1b66b1cf4bed57902ef836ee (diff)
feat: add xmllint formatter (#259)
* feat: add xmllint formatter * doc: shorten xmllint description --------- Co-authored-by: Steven Arcangeli <506791+stevearc@users.noreply.github.com>
-rw-r--r--README.md1
-rw-r--r--doc/conform.txt2
-rw-r--r--lua/conform/formatters/xmllint.lua9
3 files changed, 12 insertions, 0 deletions
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", "-" },
+}