diff options
author | Lewis Russell <lewis6991@gmail.com> | 2024-02-27 15:20:32 +0000 |
---|---|---|
committer | Lewis Russell <me@lewisr.dev> | 2024-03-01 23:02:18 +0000 |
commit | a5fe8f59d98398d04bed8586cee73864bbcdde92 (patch) | |
tree | 9dd8086edc1e572ba1fddd03df17918dcd76a72e /scripts/text_utils.lua | |
parent | 813dd36b72979dfd05479eb6402b9becc0faea29 (diff) | |
download | rneovim-a5fe8f59d98398d04bed8586cee73864bbcdde92.tar.gz rneovim-a5fe8f59d98398d04bed8586cee73864bbcdde92.tar.bz2 rneovim-a5fe8f59d98398d04bed8586cee73864bbcdde92.zip |
docs: improve/add documentation of Lua types
- Added `@inlinedoc` so single use Lua types can be inlined into the
functions docs. E.g.
```lua
--- @class myopts
--- @inlinedoc
---
--- Documentation for some field
--- @field somefield integer
--- @param opts myOpts
function foo(opts)
end
```
Will be rendered as
```
foo(opts)
Parameters:
- {opts} (table) Object with the fields:
- somefield (integer) Documentation
for some field
```
- Marked many classes with with `@nodoc` or `(private)`.
We can eventually introduce these when we want to.
Diffstat (limited to 'scripts/text_utils.lua')
-rw-r--r-- | scripts/text_utils.lua | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/scripts/text_utils.lua b/scripts/text_utils.lua index 5167ec42f2..ec0ccf668b 100644 --- a/scripts/text_utils.lua +++ b/scripts/text_utils.lua @@ -175,7 +175,11 @@ local function render_md(node, start_indent, indent, text_width, level, is_list) error(fmt('cannot render:\n%s', vim.inspect(node))) end for i, child in ipairs(node) do - vim.list_extend(parts, render_md(child, start_indent, indent, text_width, level + 1, is_list)) + local start_indent0 = i == 1 and start_indent or indent + vim.list_extend( + parts, + render_md(child, start_indent0, indent, text_width, level + 1, is_list) + ) if node.type ~= 'list' and i ~= #node then if (node[i + 1] or {}).type ~= 'list' then parts[#parts + 1] = '\n' |