feat(picker.preview): support for images and render markdown

This commit is contained in:
Folke Lemaitre 2025-10-28 10:39:26 +01:00
parent a39b081984
commit 9585da6c57
No known key found for this signature in database
GPG key ID: 9B52594D560070AB

View file

@ -418,4 +418,24 @@ end
return
end
end
function M:markdown()
if not self.win:valid() then
return
end
local buf, win = self.win.buf, self.win.win ---@type number, number
vim.bo[buf].filetype = "markdown"
Snacks.image.doc.attach(buf)
if package.loaded["render-markdown"] then
require("render-markdown.core.ui").update(buf, win, "Snacks", true)
elseif package.loaded["markview"] then
local strict = package.loaded["markview"].strict_render
if strict then
strict:render(buf)
end
end
end
return M