Closed balpert89 closed 3 weeks ago
Based on these errors
- ERROR Failed to run healthcheck for "render-markdown" plugin. Exception:
.../lazy/render-markdown.nvim/lua/render-markdown/state.lua:199: bad argument #1 to 'pairs' (table expected, got string)
Something is very wrong in your config. I suspect you may have recently upgraded after a while and something that used to take a string property is now a table. There have a been several breaking changes all documented in the releases: https://github.com/MeanderingProgrammer/render-markdown.nvim/releases.
Can you send the configuration you have for this plugin as it is definitely not the default one, I am not interested in the iamcco/markdown-preview.nvim
/ dhruvasagar/vim-table-mode
configurations.
Ahh sorry I have copied over the wrong content. Here is the one for render-markdown
:
return {
{
"MeanderingProgrammer/render-markdown.nvim",
lazy = true,
-- TODO: re-enable when https://github.com/MeanderingProgrammer/render-markdown.nvim/issues/144 is fixed
enabled = false,
ft = { "markdown", "pandoc" },
commands = { "RenderMarkdown" },
opts = {
bullets = { "", "", "◆", "◇" },
headings = { " ", " ", " ", " ", " ", " " },
checkbox = {
unchecked = " ",
checked = " ",
},
file_types = { "markdown", "pandoc" },
highlights = {
checkbox = {
unchecked = "@markup.list.unchecked",
checked = "@markdown_check_done",
},
},
},
dependencies = { "nvim-treesitter/nvim-treesitter", "nvim-tree/nvim-web-devicons" },
config = function(_, opts)
require("render-markdown").setup(opts)
local function toggle_checkbox(char)
local current_line = vim.api.nvim_get_current_line()
local _, _, checkbox_state = string.find(current_line, "%[([ " .. char .. string.upper(char) .. "])%]")
if checkbox_state then
local new_state = checkbox_state == " " and char or " "
local new_line = string.gsub(current_line, "%[.-%]", "[" .. new_state .. "]")
vim.api.nvim_set_current_line(new_line)
end
end
vim.keymap.set("n", "<Leader>XC", function()
toggle_checkbox("x")
end, { noremap = true, silent = true })
vim.keymap.set("n", "<Leader>XU", function()
toggle_checkbox("o")
end, { noremap = true, silent = true })
end,
},
}
Yes, I have missed the last breaking change it seems. Sorry for the inconvenience.
I have adapted the configuration, now it renders correctly:
return {
{
"MeanderingProgrammer/render-markdown.nvim",
lazy = true,
ft = { "markdown", "pandoc" },
commands = { "RenderMarkdown" },
opts = {
bullet = {
icons = { "", "", "◆", "◇" },
},
heading = {
icons = { " ", " ", " ", " ", " ", " " },
},
checkbox = {
unchecked = {
highlight = "@markup.list.unchecked",
icon = " ",
},
checked = {
highlight = "@markdown_check_done",
icon = " ",
},
},
file_types = { "markdown", "pandoc", "vimwiki" },
},
dependencies = { "nvim-treesitter/nvim-treesitter", "nvim-tree/nvim-web-devicons" },
config = function(_, opts)
require("render-markdown").setup(opts)
local function toggle_checkbox(char)
local current_line = vim.api.nvim_get_current_line()
local _, _, checkbox_state = string.find(current_line, "%[([ " .. char .. string.upper(char) .. "])%]")
if checkbox_state then
local new_state = checkbox_state == " " and char or " "
local new_line = string.gsub(current_line, "%[.-%]", "[" .. new_state .. "]")
vim.api.nvim_set_current_line(new_line)
end
end
vim.keymap.set("n", "<Leader>XC", function()
toggle_checkbox("x")
end, { noremap = true, silent = true })
vim.keymap.set("n", "<Leader>XU", function()
toggle_checkbox("o")
end, { noremap = true, silent = true })
end,
},
}
Perfect, was going to help get it in order since I know it can be a pain, but glad you got it figured out, sorry for the inconvenience! Breaking changes should be fairly rare going forward.
Interesting checkbox toggle logic, if you've not come across it before I'd recommend you checkout this plugin: https://github.com/tadmccorkle/markdown.nvim. Has support for toggling tasks and some more conveniences.
Neovim version (nvim -v)
0.10.0
Operating system
Linux
Terminal emulator / GUI
Alacritty
Describe the bug
Opening a formerly working buffer with an .md file in it. Caused by a removed nil check in
pad
:https://github.com/MeanderingProgrammer/render-markdown.nvim/commit/275f28943ab9ce6017f90bab56c5b5b3c651c269#diff-be254f6b492811ae05ef31fed1bb6212b73ec873b0363247bf0fccf2b5cd2306L38-R45
Expected behavior
Opens correctly.
Healthcheck output
Plugin configuration
Plugin error log
Stacktrace
Confirmations
Additional information
No response