8000 mini.nvim/doc/mini-doc.txt at main · mintoya/mini.nvim · GitHub
[go: up one dir, main page]

Skip to content

Latest commit

 

History

History
434 lines (373 loc) · 20.2 KB

mini-doc.txt

File metadata and controls

434 lines (373 loc) · 20.2 KB
this is a return from the latest call of this function.
------------------------------------------------------------------------------
*MiniDoc.afterlines_to_code()*
`MiniDoc.afterlines_to_code`({struct})
Convert afterlines to code
This function is designed to be used together with `@eval` section to
automate documentation of certain values (notably default values of a
table). It processes afterlines based on certain directives and makes
output look like a Lua code block.
Most common usage is by adding the following section in your annotation: >
---@eval return MiniDoc.afterlines_to_code(MiniDoc.current.eval_section)
<
# Directives ~
Directives are special comments that are processed using Lua string pattern
capabilities (so beware of false positives). Each directive should be put
on its separate line. Supported directives:
- `--minidoc_afterlines_end` denotes a line at afterlines end. Only all
lines before it will be considered as afterlines. Useful if there is
extra code in afterlines which shouldn't be used.
- `--minidoc_replace_start <replacement>` and `--minidoc_replace_end`
denote lines between them which should be replaced with `<replacement>`.
Useful for manually changing what should be placed in output like in case
of replacing function body with something else.
Here is an example. Suppose having these afterlines: >lua
--minidoc_replace_start {
M.config = {
--minidoc_replace_end
param_one = 1,
--minidoc_replace_start param_fun = --<function>
param_fun = function(x)
return x + 1
end
--minidoc_replace_end
}
--minidoc_afterlines_end
return M
<
After adding `@eval` section those will be formatted as: >
{
param_one = 1,
param_fun = --<function>
}
<
Parameters ~
{struct} `(table)` Block or section structure which after lines will be
converted to code.
Return ~
`(string|nil)` Single string (using `\n` to separate lines) describing
afterlines as Lua code block in help file. If `nil`, input is not valid.
vim:tw=78:ts=8:noet:ft=help:norl:
0