aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--README.md1
-rw-r--r--doc/conform.txt1
-rw-r--r--lua/conform/formatters/d2.lua9
3 files changed, 11 insertions, 0 deletions
diff --git a/README.md b/README.md
index dd63501..99f7186 100644
--- a/README.md
+++ b/README.md
@@ -207,6 +207,7 @@ You can view this list in vim with `:help conform-formatters`
- [crystal](https://crystal-lang.org/) - Format Crystal code.
- [csharpier](https://github.com/belav/csharpier) - The opinionated C# code formatter.
- [cue_fmt](https://cuelang.org) - Format CUE files using `cue fmt` command.
+- [d2](https://github.com/terrastruct/d2) - D2 diagram formatter.
- [darker](https://github.com/akaihola/darker) - Run black only on changed lines.
- [dart_format](https://dart.dev/tools/dart-format) - Replace the whitespace in your program with formatting that follows Dart guidelines.
- [deno_fmt](https://deno.land/manual/tools/formatter) - Use [Deno](https://deno.land/) to format TypeScript, JavaScript/JSON and markdown.
diff --git a/doc/conform.txt b/doc/conform.txt
index 06a2714..5ead314 100644
--- a/doc/conform.txt
+++ b/doc/conform.txt
@@ -238,6 +238,7 @@ FORMATTERS *conform-formatter
`crystal` - Format Crystal code.
`csharpier` - The opinionated C# code formatter.
`cue_fmt` - Format CUE files using `cue fmt` command.
+`d2` - D2 diagram formatter.
`darker` - Run black only on changed lines.
`dart_format` - Replace the whitespace in your program with formatting that
follows Dart guidelines.
diff --git a/lua/conform/formatters/d2.lua b/lua/conform/formatters/d2.lua
new file mode 100644
index 0000000..2858e80
--- /dev/null
+++ b/lua/conform/formatters/d2.lua
@@ -0,0 +1,9 @@
+---@type conform.FileFormatterConfig
+return {
+ meta = {
+ url = "https://github.com/terrastruct/d2",
+ description = "D2 is a modern diagram scripting language that turns text to diagrams.",
+ },
+ command = "d2",
+ args = { "fmt", "-" },
+}