From 5e7a000e4f239b56077e5a38680c5e9a0bf60e6a Mon Sep 17 00:00:00 2001 From: giskard Date: Thu, 6 Jun 2024 14:52:53 +0800 Subject: 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> --- README.md | 1 + doc/conform.txt | 1 + lua/conform/formatters/d2.lua | 9 +++++++++ 3 files changed, 11 insertions(+) create mode 100644 lua/conform/formatters/d2.lua 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", "-" }, +} -- cgit v1.2.3-70-g09d2