aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorgiskard <rtgiskard@gmail.com>2024-06-06 14:52:53 +0800
committerGitHub <noreply@github.com>2024-06-05 23:52:53 -0700
commit5e7a000e4f239b56077e5a38680c5e9a0bf60e6a (patch)
treee081014638aca9c71e5668313b6d539616da50b8
parent44879ffd0268ba931532537b1ee44ed77cd90a5d (diff)
feat: add support for d2 (#445)
* feat: add support for d2 * doc: normalize description --------- Co-authored-by: Steven Arcangeli <506791+stevearc@users.noreply.github.com>
-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", "-" },
+}