docs: api events

This commit is contained in:
Justin M. Keyes
2025-08-26 19:33:16 -04:00
parent 9c3099f0cf
commit 2affb8373f
7 changed files with 133 additions and 70 deletions

View File

@@ -1,5 +1,8 @@
#!/usr/bin/env -S nvim -l
--- Generates Nvim :help docs from Lua/C docstrings
--- Generates Nvim :help docs from Lua/C docstrings.
---
--- Usage:
--- make doc
---
--- The generated :help text for each function is formatted as follows:
--- - Max width of 78 columns (`TEXT_WIDTH`).
@@ -106,6 +109,7 @@ local config = {
filename = 'api.txt',
section_order = {
-- Sections at the top, in a specific order:
'events.c',
'vim.c',
'vimscript.c',
@@ -126,11 +130,22 @@ local config = {
['vim.c'] = 'Global',
},
section_fmt = function(name)
if name == 'Events' then
return 'Global Events'
end
return name .. ' Functions'
end,
helptag_fmt = function(name)
return fmt('api-%s', name:lower())
end,
fn_helptag_fmt = function(fun)
local name = fun.name
if vim.endswith(name, '_event') then
return name
end
return fn_helptag_fmt_common(fun)
end,
},
lua = {
filename = 'lua.txt',