Skip to content

Commit

Permalink
feat: add markdown-toc (#75)
Browse files Browse the repository at this point in the history
* feat: add `markdown-toc`

* fix: ran stylua

* fix: correct indent when formatting in different buffer
  • Loading branch information
chrisgrieser authored Sep 25, 2023
1 parent 34daf23 commit de58b06
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions lua/conform/formatters/markdown-toc.lua
Original file line number Diff line number Diff line change
@@ -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,
}

0 comments on commit de58b06

Please sign in to comment.