summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--lua/conform/formatters/markdown-toc.lua15
1 files changed, 15 insertions, 0 deletions
diff --git a/lua/conform/formatters/markdown-toc.lua b/lua/conform/formatters/markdown-toc.lua
new file mode 100644
index 0000000..129d50e
--- /dev/null
+++ b/lua/conform/formatters/markdown-toc.lua
@@ -0,0 +1,15 @@
+---@type conform.FileFormatterConfig
+return {
+ meta = {
+ url = "https://github.com/jonschlinkert/markdown-toc",
+ description = "API and CLI for generating a markdown TOC (table of contents) for a README or any markdown files.",
+ },
+ command = "markdown-toc",
+ stdin = false,
+ args = function(ctx)
+ -- use the indentation set in the current buffer, effectively allowing us to
+ -- use values from .editorconfig
+ local indent = vim.bo[ctx.buf].expandtab and (" "):rep(vim.bo[ctx.buf].tabstop) or "\t"
+ return { "--indent=" .. indent, "-i", "$FILENAME" }
+ end,
+}