mirror of
https://github.com/folke/snacks.nvim
synced 2025-08-04 18:58:12 +00:00
docs: docgen
This commit is contained in:
parent
e039139291
commit
a4fe279bf4
5 changed files with 80 additions and 34 deletions
|
@ -96,7 +96,6 @@ In case of issues, make sure to run `:checkhealth snacks`.
|
|||
-- enable image viewer for documents
|
||||
-- a treesitter parser must be available for the enabled languages.
|
||||
enabled = true,
|
||||
math = true, -- enable math expression rendering
|
||||
-- render the image inline in the buffer
|
||||
-- if your env doesn't support unicode placeholders, this will be disabled
|
||||
-- takes precedence over `opts.float` on supported terminals
|
||||
|
@ -133,12 +132,6 @@ In case of issues, make sure to run `:checkhealth snacks`.
|
|||
---@class snacks.image.convert.Config
|
||||
convert = {
|
||||
notify = true, -- show a notification on error
|
||||
math = {
|
||||
font_size = "Large", -- see https://www.sascha-frank.com/latex-font-size.html
|
||||
-- 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" },
|
||||
},
|
||||
---@type snacks.image.args
|
||||
mermaid = function()
|
||||
local theme = vim.o.background == "light" and "neutral" or "dark"
|
||||
|
@ -152,6 +145,36 @@ In case of issues, make sure to run `:checkhealth snacks`.
|
|||
pdf = { "-density", 192, "{src}[0]", "-background", "white", "-alpha", "remove", "-trim" },
|
||||
},
|
||||
},
|
||||
math = {
|
||||
enabled = true, -- enable math expression rendering
|
||||
-- in the templates below, `${header}` comes from any section in your document,
|
||||
-- between a start/end header comment. Comment syntax is language-specific.
|
||||
-- * start comment: `// snacks: header start`
|
||||
-- * end comment: `// snacks: header end`
|
||||
typst = {
|
||||
tpl = [[
|
||||
#set page(width: auto, height: auto, margin: (x: 2pt, y: 2pt))
|
||||
#show math.equation.where(block: false): set text(top-edge: "bounds", bottom-edge: "bounds")
|
||||
#set text(size: 12pt, fill: rgb("${color}"))
|
||||
${header}
|
||||
${content}]],
|
||||
},
|
||||
latex = {
|
||||
font_size = "Large", -- see https://www.sascha-frank.com/latex-font-size.html
|
||||
-- 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" },
|
||||
tpl = [[
|
||||
\documentclass[preview,border=2pt,varwidth,12pt]{standalone}
|
||||
\usepackage{${packages}}
|
||||
\begin{document}
|
||||
${header}
|
||||
{ \${font_size} \selectfont
|
||||
\color[HTML]{${color}}
|
||||
${content}}
|
||||
\end{document}]],
|
||||
},
|
||||
},
|
||||
}
|
||||
```
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue