feat(image): proper inline rendering of math expressions. Closes #1318. Closes #1454

This commit is contained in:
Folke Lemaitre 2025-03-01 08:01:11 +01:00
parent 1bbd47973d
commit 6ea4fa72dc
No known key found for this signature in database
GPG key ID: 41F8B1FBACAE2040
7 changed files with 807 additions and 365 deletions

View file

@ -4,7 +4,8 @@ local M = {}
---@param buf number
---@param opts? snacks.image.Opts|{src?: string}
function M.attach(buf, opts)
local file = opts and opts.src or vim.api.nvim_buf_get_name(buf)
opts = opts or {}
local file = opts.src or vim.api.nvim_buf_get_name(buf)
if not Snacks.image.supports(file) then
local lines = {} ---@type string[]
lines[#lines + 1] = "# Image viewer"
@ -28,6 +29,8 @@ function M.attach(buf, opts)
modified = false,
swapfile = false,
})
opts.conceal = true
opts.auto_resize = true
return Snacks.image.placement.new(buf, file, opts)
end
end