docs: docgen

This commit is contained in:
Folke Lemaitre 2025-02-20 17:11:40 +01:00
parent e039139291
commit a4fe279bf4
No known key found for this signature in database
GPG key ID: 41F8B1FBACAE2040
5 changed files with 80 additions and 34 deletions

View file

@ -115,7 +115,6 @@ In case of issues, make sure to run `:checkhealth snacks`.
doc = {
-- enable image viewer for documents
-- a treesitter parser must be available for the enabled languages.
-- supported language injections: markdown, html
enabled = true,
-- render the image inline in the buffer
-- if your env doesn't support unicode placeholders, this will be disabled
@ -127,8 +126,7 @@ In case of issues, make sure to run `:checkhealth snacks`.
max_width = 80,
max_height = 40,
-- Set to `true`, to conceal the image text when rendering inline.
-- (experimental)
conceal = false,
conceal = false, -- (experimental)
},
img_dirs = { "img", "images", "assets", "static", "public", "media", "attachments" },
-- window options applied to windows displaying image buffers
@ -154,12 +152,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"
@ -173,6 +165,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}]],
},
},
}
<

View file

@ -50,6 +50,7 @@ Table of Contents *snacks-layout-table-of-contents*
---@field fullscreen? boolean open in fullscreen
---@field hidden? string[] list of windows that will be excluded from the layout (but can be toggled)
---@field on_update? fun(layout: snacks.layout)
---@field on_update_pre? fun(layout: snacks.layout)
{
layout = {
width = 0.6,

View file

@ -798,23 +798,6 @@ TROUBLE *snacks-picker-examples-trouble*
---@field notify? boolean
<
>lua
---@alias snacks.Picker.ref (fun():snacks.Picker?)|{value?: snacks.Picker}
<
>lua
---@class snacks.picker.Last
---@field cursor number
---@field topline number
---@field opts? snacks.picker.Config
---@field selected snacks.picker.Item[]
---@field filter snacks.picker.Filter
<
>lua
---@alias snacks.picker.history.Record {pattern: string, search: string, live?: boolean}
<
>lua
---@alias snacks.picker.Extmark vim.api.keyset.set_extmark|{col:number, row?:number, field?:string}
---@alias snacks.picker.Text {[1]:string, [2]:string?, virtual?:boolean, field?:string}
@ -893,6 +876,23 @@ that shows a preview based on the item data.
---@field preview? snacks.win.Config|{} preview window config
<
>lua
---@alias snacks.Picker.ref (fun():snacks.Picker?)|{value?: snacks.Picker}
<
>lua
---@class snacks.picker.Last
---@field cursor number
---@field topline number
---@field opts? snacks.picker.Config
---@field selected snacks.picker.Item[]
---@field filter snacks.picker.Filter
<
>lua
---@alias snacks.picker.history.Record {pattern: string, search: string, live?: boolean}
<
==============================================================================
7. Module *snacks-picker-module*

View file

@ -1,4 +1,4 @@
*snacks.nvim.txt* For Neovim Last change: 2025 February 20
*snacks* For Neovim Last change: 2025 February 20
==============================================================================
Table of Contents *snacks.nvim-table-of-contents*

View file

@ -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}]],
},
},
}
```