diff --git a/lua/lazyvim/plugins/extras/lang/markdown.lua b/lua/lazyvim/plugins/extras/lang/markdown.lua index ac5405e3..18fd63d2 100644 --- a/lua/lazyvim/plugins/extras/lang/markdown.lua +++ b/lua/lazyvim/plugins/extras/lang/markdown.lua @@ -56,11 +56,23 @@ return { { "mfussenegger/nvim-lint", optional = true, - opts = { - linters_by_ft = { - markdown = { "markdownlint-cli2" }, - }, - }, + opts = function(_, opts) + opts.linters_by_ft = opts.linters_by_ft or {} + opts.linters_by_ft.markdown = { "markdownlint-cli2" } + + opts.linters = opts.linters or {} + opts.linters["markdownlint-cli2"] = { + -- Disable stdin to enable config file discovery. + -- markdownlint-cli2 traverses directories to find .markdownlint.json, + -- .markdownlint-cli2.jsonc, etc., but this only works with file paths. + stdin = false, + args = {}, + parser = require("lint.parser").from_errorformat("%f:%l:%c %m,%f:%l %m", { + source = "markdownlint", + severity = vim.diagnostic.severity.WARN, + }), + } + end, }, { "neovim/nvim-lspconfig",