mirror of
https://github.com/folke/snacks.nvim
synced 2025-12-23 08:47:57 +00:00
feat(picker.preview): support for images and render markdown
This commit is contained in:
parent
a39b081984
commit
9585da6c57
1 changed files with 20 additions and 0 deletions
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue