mirror of
https://github.com/folke/snacks.nvim
synced 2025-07-07 21:25:11 +00:00
docs: docgen
This commit is contained in:
parent
e039139291
commit
a4fe279bf4
5 changed files with 80 additions and 34 deletions
|
@ -115,7 +115,6 @@ In case of issues, make sure to run `:checkhealth snacks`.
|
||||||
doc = {
|
doc = {
|
||||||
-- enable image viewer for documents
|
-- enable image viewer for documents
|
||||||
-- a treesitter parser must be available for the enabled languages.
|
-- a treesitter parser must be available for the enabled languages.
|
||||||
-- supported language injections: markdown, html
|
|
||||||
enabled = true,
|
enabled = true,
|
||||||
-- render the image inline in the buffer
|
-- render the image inline in the buffer
|
||||||
-- if your env doesn't support unicode placeholders, this will be disabled
|
-- 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_width = 80,
|
||||||
max_height = 40,
|
max_height = 40,
|
||||||
-- Set to `true`, to conceal the image text when rendering inline.
|
-- Set to `true`, to conceal the image text when rendering inline.
|
||||||
-- (experimental)
|
conceal = false, -- (experimental)
|
||||||
conceal = false,
|
|
||||||
},
|
},
|
||||||
img_dirs = { "img", "images", "assets", "static", "public", "media", "attachments" },
|
img_dirs = { "img", "images", "assets", "static", "public", "media", "attachments" },
|
||||||
-- window options applied to windows displaying image buffers
|
-- 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
|
---@class snacks.image.convert.Config
|
||||||
convert = {
|
convert = {
|
||||||
notify = true, -- show a notification on error
|
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
|
---@type snacks.image.args
|
||||||
mermaid = function()
|
mermaid = function()
|
||||||
local theme = vim.o.background == "light" and "neutral" or "dark"
|
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" },
|
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}]],
|
||||||
|
},
|
||||||
|
},
|
||||||
}
|
}
|
||||||
<
|
<
|
||||||
|
|
||||||
|
|
|
@ -50,6 +50,7 @@ Table of Contents *snacks-layout-table-of-contents*
|
||||||
---@field fullscreen? boolean open in fullscreen
|
---@field fullscreen? boolean open in fullscreen
|
||||||
---@field hidden? string[] list of windows that will be excluded from the layout (but can be toggled)
|
---@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? fun(layout: snacks.layout)
|
||||||
|
---@field on_update_pre? fun(layout: snacks.layout)
|
||||||
{
|
{
|
||||||
layout = {
|
layout = {
|
||||||
width = 0.6,
|
width = 0.6,
|
||||||
|
|
|
@ -798,23 +798,6 @@ TROUBLE *snacks-picker-examples-trouble*
|
||||||
---@field notify? boolean
|
---@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
|
>lua
|
||||||
---@alias snacks.picker.Extmark vim.api.keyset.set_extmark|{col:number, row?:number, field?:string}
|
---@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}
|
---@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
|
---@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*
|
7. Module *snacks-picker-module*
|
||||||
|
|
|
@ -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*
|
Table of Contents *snacks.nvim-table-of-contents*
|
||||||
|
|
|
@ -96,7 +96,6 @@ In case of issues, make sure to run `:checkhealth snacks`.
|
||||||
-- enable image viewer for documents
|
-- enable image viewer for documents
|
||||||
-- a treesitter parser must be available for the enabled languages.
|
-- a treesitter parser must be available for the enabled languages.
|
||||||
enabled = true,
|
enabled = true,
|
||||||
math = true, -- enable math expression rendering
|
|
||||||
-- render the image inline in the buffer
|
-- render the image inline in the buffer
|
||||||
-- if your env doesn't support unicode placeholders, this will be disabled
|
-- if your env doesn't support unicode placeholders, this will be disabled
|
||||||
-- takes precedence over `opts.float` on supported terminals
|
-- 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
|
---@class snacks.image.convert.Config
|
||||||
convert = {
|
convert = {
|
||||||
notify = true, -- show a notification on error
|
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
|
---@type snacks.image.args
|
||||||
mermaid = function()
|
mermaid = function()
|
||||||
local theme = vim.o.background == "light" and "neutral" or "dark"
|
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" },
|
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