docs: better doc tags. Closes #1234

This commit is contained in:
Folke Lemaitre 2025-02-17 13:41:34 +01:00
parent 3dfcc683d5
commit 4752a87d54
No known key found for this signature in database
GPG key ID: 41F8B1FBACAE2040
37 changed files with 95 additions and 58 deletions

View file

@ -1,4 +1,4 @@
*snacks-animate.txt* snacks.nvim *snacks-animate* snacks_animate
============================================================================== ==============================================================================
Table of Contents *snacks-animate-table-of-contents* Table of Contents *snacks-animate-table-of-contents*

View file

@ -1,4 +1,4 @@
*snacks-bigfile.txt* snacks.nvim *snacks-bigfile* snacks_bigfile
============================================================================== ==============================================================================
Table of Contents *snacks-bigfile-table-of-contents* Table of Contents *snacks-bigfile-table-of-contents*

View file

@ -1,4 +1,4 @@
*snacks-bufdelete.txt* snacks.nvim *snacks-bufdelete* snacks_bufdelete
============================================================================== ==============================================================================
Table of Contents *snacks-bufdelete-table-of-contents* Table of Contents *snacks-bufdelete-table-of-contents*

View file

@ -1,4 +1,4 @@
*snacks-dashboard.txt* snacks.nvim *snacks-dashboard* snacks_dashboard
============================================================================== ==============================================================================
Table of Contents *snacks-dashboard-table-of-contents* Table of Contents *snacks-dashboard-table-of-contents*

View file

@ -1,4 +1,4 @@
*snacks-debug.txt* snacks.nvim *snacks-debug* snacks_debug
============================================================================== ==============================================================================
Table of Contents *snacks-debug-table-of-contents* Table of Contents *snacks-debug-table-of-contents*
@ -7,6 +7,7 @@ Table of Contents *snacks-debug-table-of-contents*
2. Module |snacks-debug-module| 2. Module |snacks-debug-module|
- Snacks.debug() |snacks-debug-module-snacks.debug()| - Snacks.debug() |snacks-debug-module-snacks.debug()|
- Snacks.debug.backtrace() |snacks-debug-module-snacks.debug.backtrace()| - Snacks.debug.backtrace() |snacks-debug-module-snacks.debug.backtrace()|
- Snacks.debug.cmd() |snacks-debug-module-snacks.debug.cmd()|
- Snacks.debug.inspect() |snacks-debug-module-snacks.debug.inspect()| - Snacks.debug.inspect() |snacks-debug-module-snacks.debug.inspect()|
- Snacks.debug.log() |snacks-debug-module-snacks.debug.log()| - Snacks.debug.log() |snacks-debug-module-snacks.debug.log()|
- Snacks.debug.metrics() |snacks-debug-module-snacks.debug.metrics()| - Snacks.debug.metrics() |snacks-debug-module-snacks.debug.metrics()|
@ -73,6 +74,14 @@ Show a notification with a pretty backtrace
< <
`Snacks.debug.cmd()` *Snacks.debug.cmd()*
>lua
---@param opts {cmd: string|string[], args?: string[], cwd?: string}
Snacks.debug.cmd(opts)
<
`Snacks.debug.inspect()` *Snacks.debug.inspect()* `Snacks.debug.inspect()` *Snacks.debug.inspect()*
Show a notification with a pretty printed dump of the object(s) with lua Show a notification with a pretty printed dump of the object(s) with lua

View file

@ -1,4 +1,4 @@
*snacks-dim.txt* snacks.nvim *snacks-dim* snacks_dim
============================================================================== ==============================================================================
Table of Contents *snacks-dim-table-of-contents* Table of Contents *snacks-dim-table-of-contents*

View file

@ -1,4 +1,4 @@
*snacks-explorer.txt* snacks.nvim *snacks-explorer* snacks_explorer
============================================================================== ==============================================================================
Table of Contents *snacks-explorer-table-of-contents* Table of Contents *snacks-explorer-table-of-contents*

View file

@ -1,4 +1,4 @@
*snacks-git.txt* snacks.nvim *snacks-git* snacks_git
============================================================================== ==============================================================================
Table of Contents *snacks-git-table-of-contents* Table of Contents *snacks-git-table-of-contents*

View file

@ -1,4 +1,4 @@
*snacks-gitbrowse.txt* snacks.nvim *snacks-gitbrowse* snacks_gitbrowse
============================================================================== ==============================================================================
Table of Contents *snacks-gitbrowse-table-of-contents* Table of Contents *snacks-gitbrowse-table-of-contents*

View file

@ -1,4 +1,4 @@
*snacks-health.txt* snacks.nvim *snacks-health* snacks_health
============================================================================== ==============================================================================
Table of Contents *snacks-health-table-of-contents* Table of Contents *snacks-health-table-of-contents*

View file

@ -1,4 +1,4 @@
*snacks-image.txt* snacks.nvim *snacks-image* snacks_image
============================================================================== ==============================================================================
Table of Contents *snacks-image-table-of-contents* Table of Contents *snacks-image-table-of-contents*
@ -10,6 +10,7 @@ Table of Contents *snacks-image-table-of-contents*
4. Types |snacks-image-types| 4. Types |snacks-image-types|
5. Module |snacks-image-module| 5. Module |snacks-image-module|
- Snacks.image.hover() |snacks-image-module-snacks.image.hover()| - Snacks.image.hover() |snacks-image-module-snacks.image.hover()|
- Snacks.image.langs() |snacks-image-module-snacks.image.langs()|
- Snacks.image.supports() |snacks-image-module-snacks.image.supports()| - Snacks.image.supports() |snacks-image-module-snacks.image.supports()|
- Snacks.image.supports_file()|snacks-image-module-snacks.image.supports_file()| - Snacks.image.supports_file()|snacks-image-module-snacks.image.supports_file()|
- Snacks.image.supports_terminal()|snacks-image-module-snacks.image.supports_terminal()| - Snacks.image.supports_terminal()|snacks-image-module-snacks.image.supports_terminal()|
@ -44,6 +45,17 @@ In order to automatically display the image when opening an image file, or to
have imaged displayed in supported document formats like `markdown` or `html`, have imaged displayed in supported document formats like `markdown` or `html`,
you need to enable the `image` plugin in your `snacks` config. you need to enable the `image` plugin in your `snacks` config.
Supported document formats are:
- markdown
- html
- norg
- tsx
- javascript
- css
- vue
- angular
ImageMagick <https://imagemagick.org/index.php> is required to convert images ImageMagick <https://imagemagick.org/index.php> is required to convert images
to the supported formats (all except PNG). to the supported formats (all except PNG).
@ -90,7 +102,6 @@ In case of issues, make sure to run `:checkhealth snacks`.
-- 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 -- supported language injections: markdown, html
enabled = true, enabled = true,
lang = { "markdown", "html", "norg", "tsx", "javascript", "css", "vue", "angular" },
-- 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
@ -101,6 +112,7 @@ In case of issues, make sure to run `:checkhealth snacks`.
max_width = 80, max_width = 80,
max_height = 40, max_height = 40,
}, },
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
-- an image buffer is a buffer with `filetype=image` -- an image buffer is a buffer with `filetype=image`
wo = { wo = {
@ -114,6 +126,12 @@ In case of issues, make sure to run `:checkhealth snacks`.
spell = false, spell = false,
statuscolumn = "", statuscolumn = "",
}, },
cache = vim.fn.stdpath("cache") .. "/snacks/image",
debug = {
request = false,
convert = false,
placement = false,
},
env = {}, env = {},
} }
< <
@ -145,8 +163,6 @@ SNACKS_IMAGE *snacks-image-styles-snacks_image*
============================================================================== ==============================================================================
4. Types *snacks-image-types* 4. Types *snacks-image-types*
TODO: - tsx / jsx - url decode? - look for all images?
>lua >lua
---@alias snacks.image.Size {width: number, height: number} ---@alias snacks.image.Size {width: number, height: number}
---@alias snacks.image.Pos {[1]: number, [2]: number} ---@alias snacks.image.Pos {[1]: number, [2]: number}
@ -191,6 +207,7 @@ TODO: - tsx / jsx - url decode? - look for all images?
---@field util snacks.image.util ---@field util snacks.image.util
---@field buf snacks.image.buf ---@field buf snacks.image.buf
---@field doc snacks.image.doc ---@field doc snacks.image.doc
---@field convert snacks.image.convert
Snacks.image = {} Snacks.image = {}
< <
@ -204,6 +221,14 @@ Show the image at the cursor in a floating window
< <
`Snacks.image.langs()` *Snacks.image.langs()*
>lua
---@return string[]
Snacks.image.langs()
<
`Snacks.image.supports()` *Snacks.image.supports()* `Snacks.image.supports()` *Snacks.image.supports()*
Check if the file format is supported and the terminal supports the kitty Check if the file format is supported and the terminal supports the kitty

View file

@ -1,4 +1,4 @@
*snacks-indent.txt* snacks.nvim *snacks-indent* snacks_indent
============================================================================== ==============================================================================
Table of Contents *snacks-indent-table-of-contents* Table of Contents *snacks-indent-table-of-contents*

View file

@ -1,4 +1,4 @@
*snacks-init.txt* snacks.nvim *snacks-init* snacks_init
============================================================================== ==============================================================================
Table of Contents *snacks-init-table-of-contents* Table of Contents *snacks-init-table-of-contents*

View file

@ -1,4 +1,4 @@
*snacks-input.txt* snacks.nvim *snacks-input* snacks_input
============================================================================== ==============================================================================
Table of Contents *snacks-input-table-of-contents* Table of Contents *snacks-input-table-of-contents*

View file

@ -1,4 +1,4 @@
*snacks-layout.txt* snacks.nvim *snacks-layout* snacks_layout
============================================================================== ==============================================================================
Table of Contents *snacks-layout-table-of-contents* Table of Contents *snacks-layout-table-of-contents*

View file

@ -1,4 +1,4 @@
*snacks-lazygit.txt* snacks.nvim *snacks-lazygit* snacks_lazygit
============================================================================== ==============================================================================
Table of Contents *snacks-lazygit-table-of-contents* Table of Contents *snacks-lazygit-table-of-contents*

View file

@ -1,4 +1,4 @@
*snacks-meta.txt* snacks.nvim *snacks-meta* snacks_meta
============================================================================== ==============================================================================
Table of Contents *snacks-meta-table-of-contents* Table of Contents *snacks-meta-table-of-contents*

View file

@ -1,4 +1,4 @@
*snacks-notifier.txt* snacks.nvim *snacks-notifier* snacks_notifier
============================================================================== ==============================================================================
Table of Contents *snacks-notifier-table-of-contents* Table of Contents *snacks-notifier-table-of-contents*

View file

@ -1,4 +1,4 @@
*snacks-notify.txt* snacks.nvim *snacks-notify* snacks_notify
============================================================================== ==============================================================================
Table of Contents *snacks-notify-table-of-contents* Table of Contents *snacks-notify-table-of-contents*

View file

@ -1,4 +1,4 @@
*snacks-picker.txt* snacks.nvim *snacks-picker* snacks_picker
============================================================================== ==============================================================================
Table of Contents *snacks-picker-table-of-contents* Table of Contents *snacks-picker-table-of-contents*
@ -793,6 +793,23 @@ 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}
@ -871,23 +888,6 @@ 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*

View file

@ -1,4 +1,4 @@
*snacks-profiler.txt* snacks.nvim *snacks-profiler* snacks_profiler
============================================================================== ==============================================================================
Table of Contents *snacks-profiler-table-of-contents* Table of Contents *snacks-profiler-table-of-contents*

View file

@ -1,4 +1,4 @@
*snacks-quickfile.txt* snacks.nvim *snacks-quickfile* snacks_quickfile
============================================================================== ==============================================================================
Table of Contents *snacks-quickfile-table-of-contents* Table of Contents *snacks-quickfile-table-of-contents*

View file

@ -1,4 +1,4 @@
*snacks-rename.txt* snacks.nvim *snacks-rename* snacks_rename
============================================================================== ==============================================================================
Table of Contents *snacks-rename-table-of-contents* Table of Contents *snacks-rename-table-of-contents*

View file

@ -1,4 +1,4 @@
*snacks-scope.txt* snacks.nvim *snacks-scope* snacks_scope
============================================================================== ==============================================================================
Table of Contents *snacks-scope-table-of-contents* Table of Contents *snacks-scope-table-of-contents*

View file

@ -1,4 +1,4 @@
*snacks-scratch.txt* snacks.nvim *snacks-scratch* snacks_scratch
============================================================================== ==============================================================================
Table of Contents *snacks-scratch-table-of-contents* Table of Contents *snacks-scratch-table-of-contents*

View file

@ -1,4 +1,4 @@
*snacks-scroll.txt* snacks.nvim *snacks-scroll* snacks_scroll
============================================================================== ==============================================================================
Table of Contents *snacks-scroll-table-of-contents* Table of Contents *snacks-scroll-table-of-contents*

View file

@ -1,4 +1,4 @@
*snacks-statuscolumn.txt* snacks.nvim *snacks-statuscolumn* snacks_statuscolumn
============================================================================== ==============================================================================
Table of Contents *snacks-statuscolumn-table-of-contents* Table of Contents *snacks-statuscolumn-table-of-contents*

View file

@ -1,4 +1,4 @@
*snacks-styles.txt* snacks.nvim *snacks-styles* snacks_styles
============================================================================== ==============================================================================
Table of Contents *snacks-styles-table-of-contents* Table of Contents *snacks-styles-table-of-contents*

View file

@ -1,4 +1,4 @@
*snacks-terminal.txt* snacks.nvim *snacks-terminal* snacks_terminal
============================================================================== ==============================================================================
Table of Contents *snacks-terminal-table-of-contents* Table of Contents *snacks-terminal-table-of-contents*

View file

@ -1,4 +1,4 @@
*snacks-toggle.txt* snacks.nvim *snacks-toggle* snacks_toggle
============================================================================== ==============================================================================
Table of Contents *snacks-toggle-table-of-contents* Table of Contents *snacks-toggle-table-of-contents*

View file

@ -1,4 +1,4 @@
*snacks-util.txt* snacks.nvim *snacks-util* snacks_util
============================================================================== ==============================================================================
Table of Contents *snacks-util-table-of-contents* Table of Contents *snacks-util-table-of-contents*
@ -63,7 +63,7 @@ Set buffer-local options.
`Snacks.util.color()` *Snacks.util.color()* `Snacks.util.color()` *Snacks.util.color()*
>lua >lua
---@param group string hl group to get color from ---@param group string|string[] hl group to get color from
---@param prop? string property to get. Defaults to "fg" ---@param prop? string property to get. Defaults to "fg"
Snacks.util.color(group, prop) Snacks.util.color(group, prop)
< <

View file

@ -1,4 +1,4 @@
*snacks-win.txt* snacks.nvim *snacks-win* snacks_win
============================================================================== ==============================================================================
Table of Contents *snacks-win-table-of-contents* Table of Contents *snacks-win-table-of-contents*

View file

@ -1,4 +1,4 @@
*snacks-words.txt* snacks.nvim *snacks-words* snacks_words
============================================================================== ==============================================================================
Table of Contents *snacks-words-table-of-contents* Table of Contents *snacks-words-table-of-contents*

View file

@ -1,4 +1,4 @@
*snacks-zen.txt* snacks.nvim *snacks-zen* snacks_zen
============================================================================== ==============================================================================
Table of Contents *snacks-zen-table-of-contents* Table of Contents *snacks-zen-table-of-contents*

View file

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

View file

@ -674,6 +674,7 @@ function M.fix_titles()
for file, t in vim.fs.dir("doc", { depth = 1 }) do for file, t in vim.fs.dir("doc", { depth = 1 }) do
if t == "file" and file:find("%.txt$") then if t == "file" and file:find("%.txt$") then
local lines = vim.fn.readfile("doc/" .. file) --[[@as string[] ]] local lines = vim.fn.readfile("doc/" .. file) --[[@as string[] ]]
lines[1] = lines[1]:gsub("%.txt", ""):gsub("%.nvim", "")
for i, line in ipairs(lines) do for i, line in ipairs(lines) do
-- Example: SNACKS.GIT.BLAME_LINE() *snacks-git-module-snacks.git.blame_line()* -- Example: SNACKS.GIT.BLAME_LINE() *snacks-git-module-snacks.git.blame_line()*
local func = line:gsub("^SNACKS.*module%-snacks(.+%(%))%*$", "Snacks%1") local func = line:gsub("^SNACKS.*module%-snacks(.+%(%))%*$", "Snacks%1")

View file

@ -13,9 +13,11 @@ fi
PANVIMDOC=~/projects/panvimdoc PANVIMDOC=~/projects/panvimdoc
for f in docs/*.md; do for f in docs/*.md; do
plugin=$(basename "$f" .md)
desc="snacks_$plugin"
$PANVIMDOC/panvimdoc.sh \ $PANVIMDOC/panvimdoc.sh \
--project-name "snacks-$(basename "$f" .md)" \ --project-name "snacks-$plugin" \
--description "snacks.nvim" \ --description "$desc" \
--input-file "$f" \ --input-file "$f" \
--vim-version "Neovim" \ --vim-version "Neovim" \
--demojify "true" \ --demojify "true" \