mirror of
https://github.com/folke/snacks.nvim
synced 2025-07-16 01:25:14 +00:00
feat(image): make math packages configurable. Closes #1295
This commit is contained in:
parent
aaed4a9411
commit
e27ba726b1
4 changed files with 20 additions and 3 deletions
|
@ -40,7 +40,8 @@ M.transforms = {
|
|||
if not content:find("^\\begin") then
|
||||
content = ("\\[%s\\]"):format(content)
|
||||
end
|
||||
local packages = { "xcolor", "amsmath", "amssymb" }
|
||||
local packages = { "xcolor" }
|
||||
vim.list_extend(packages, Snacks.image.config.convert.math.packages)
|
||||
for _, line in ipairs(vim.api.nvim_buf_get_lines(ctx.buf, 0, -1, false)) do
|
||||
if line:find("\\usepackage") then
|
||||
for _, p in ipairs(vim.split(line:match("{(.-)}") or "", ",%s*")) do
|
||||
|
|
|
@ -103,6 +103,11 @@ local defaults = {
|
|||
---@class snacks.image.convert.Config
|
||||
convert = {
|
||||
notify = true, -- show a notification on error
|
||||
math = {
|
||||
-- for latex documents, the doc packages are included automatically,
|
||||
-- but you can add more packages here. Useful for markdown documents.
|
||||
packages = { "amsmath", "amssymb", "amsfonts", "amscd", "mathtools", "physics", "siunitx", "mhchem" },
|
||||
},
|
||||
---@type snacks.image.args
|
||||
mermaid = function()
|
||||
local theme = vim.o.background == "light" and "neutral" or "dark"
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue