Skip to content

Commit 1d8c28a

Browse files
committed
mod format
1 parent 2f4c7cb commit 1d8c28a

File tree

1 file changed

+29
-4
lines changed

1 file changed

+29
-4
lines changed

lua/down/mod/mod/init.lua

Lines changed: 29 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,16 @@ M.style = {
2222
}
2323

2424
M.print = {
25-
fns = function(m)
25+
toc = function(tb)
26+
ins(tb, '## Table of Contents')
27+
for name, m in pairs(mod.mods) do
28+
ins(tb, '- [' .. name .. '](#' .. name .. ')')
29+
end
30+
end,
31+
children = function(m)
32+
end,
33+
dependants = function()
34+
2635
end,
2736
deps = function(m, tb, pre)
2837
pre = pre or ''
@@ -63,6 +72,20 @@ M.print = {
6372
end
6473
return pre .. ix .. title .. value
6574
end,
75+
methods = function(tb, m, name)
76+
ins(tb, '')
77+
ins(tb, '#### **Methods**')
78+
ins(tb, '~~~lua')
79+
local i = 0
80+
for k, v in pairs(m) do
81+
i = i + 1
82+
if type(v) == 'function' then
83+
local ix = M.print.index(nil, '\t')
84+
ins(tb, 'function ' .. name .. '.' .. k .. '()')
85+
end
86+
end
87+
ins(tb, '~~~')
88+
end,
6689
command = function(tb, pre, cmd, v, i)
6790
local index = M.print.index(i, pre)
6891
local enabled = ''
@@ -97,21 +120,23 @@ M.print = {
97120
mod = function(m, tb, i, name)
98121
local ix = M.print.index(i)
99122
local i = (i or '') .. '.'
100-
ins(tb, '### ' .. '' .. ' ' .. name)
123+
ins(tb, '### ' .. '' .. ' **' .. name .. '**')
101124
ins(tb, '')
102125
-- ins(tb, .. '`' .. (name or m.name or '') .. '`')
103126
-- M.print.commands(m, tb, m.name, '', i)
127+
M.print.toc(tb)
104128
M.print.setup(m, tb, m.name, '')
105129
M.print.commands(m, tb, m.name, '')
130+
M.print.methods(tb, m, name)
106131
end,
107132
title = function(lines)
108-
ins(lines, '# Mods loaded')
133+
ins(lines, '# down.nvim')
109134
ins(lines, '')
110135
end,
111136
mods = function(tb)
112137
local lines = tb or {}
113138
M.print.title(lines)
114-
ins(lines, '## Mods:')
139+
ins(lines, '## Mods')
115140
ins(lines, '')
116141
local i = 0
117142
for name, m in pairs(mod.mods) do

0 commit comments

Comments
 (0)