aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--README.md1
-rw-r--r--lua/conform/formatters/cbfmt.lua15
2 files changed, 16 insertions, 0 deletions
diff --git a/README.md b/README.md
index a24eb57..707483a 100644
--- a/README.md
+++ b/README.md
@@ -188,6 +188,7 @@ You can view this list in vim with `:help conform-formatters`
- [blade-formatter](https://github.com/shufo/blade-formatter) - An opinionated blade template formatter for Laravel that respects readability.
- [blue](https://github.com/grantjenks/blue) - The slightly less uncompromising Python code formatter.
- [buf](https://buf.build/docs/reference/cli/buf/format) - A new way of working with Protocol Buffers.
+- [cbfmt](https://github.com/lukas-reineke/cbfmt) - A tool to format codeblocks inside markdown and org documents.
- [clang_format](https://www.kernel.org/doc/html/latest/process/clang-format.html) - Tool to format C/C++/… code according to a set of rules and heuristics.
- [cljstyle](https://github.com/greglook/cljstyle) - Formatter for Clojure code.
- [cmake_format](https://github.com/cheshirekow/cmake_format) - Parse cmake listfiles and format them nicely.
diff --git a/lua/conform/formatters/cbfmt.lua b/lua/conform/formatters/cbfmt.lua
new file mode 100644
index 0000000..57c48e4
--- /dev/null
+++ b/lua/conform/formatters/cbfmt.lua
@@ -0,0 +1,15 @@
+local util = require("conform.util")
+---@type conform.FileFormatterConfig
+return {
+ meta = {
+ url = "https://github.com/lukas-reineke/cbfmt",
+ description = "A tool to format codeblocks inside markdown and org documents.",
+ },
+ command = "cbfmt",
+ args = { "--write", "--best-effort", "$FILENAME" },
+ cwd = util.root_file({
+ -- https://github.com/lukas-reineke/cbfmt#config
+ ".cbfmt.toml",
+ }),
+ stdin = false,
+}