aboutsummaryrefslogtreecommitdiffstats
path: root/lua/conform/formatters/markdown-toc.lua
blob: a7a969456e8ec5cde1db1241be24c2b81f7cf84d (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(self, 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,
}