summaryrefslogtreecommitdiffstats
path: root/lua/conform/formatters/markdown-toc.lua
blob: 5e1d80a6e0427f34c94342740c495679a243561d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
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(ctx.shiftwidth) or "\t"
    return { "--indent=" .. indent, "-i", "$FILENAME" }
  end,
}