Skip to content

Commit d2e0c30

Browse files
committed
Small note addition
1 parent 5a1ec67 commit d2e0c30

3 files changed

Lines changed: 27 additions & 6 deletions

File tree

src/elements/DropDown.lua

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ local tHex = require("libraries/colorHex")
1414
---@tableField selectedBg color Background when selected
1515

1616
--- A collapsible selection menu that expands to show multiple options when clicked. Supports single and multi-selection modes, custom item styling, separators, and item callbacks.
17-
--- @usage [[
17+
--- @run [[
1818
--- -- Create a styled dropdown menu
1919
--- local dropdown = main:addDropDown()
2020
--- :setPosition(5, 5)

tools/BasaltDoc/init.lua

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -141,6 +141,11 @@ BasaltDoc.registerAnnotation("@skip", function(target, args)
141141
target.skip = true
142142
end)
143143

144+
BasaltDoc.registerAnnotation("@note", function(target, args)
145+
if not target.notes then target.notes = {} end
146+
table.insert(target.notes, args)
147+
end)
148+
144149
BasaltDoc.registerAnnotation("@globalDescription", function(target, args)
145150
if args and args ~= "" then
146151
target.description = args

tools/BasaltDoc/utils/markdownGenerator.lua

Lines changed: 21 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -73,14 +73,11 @@ local function generateFunctionMarkdown(class, functions)
7373
if f.usage then
7474
table.insert(md, "### Usage")
7575
for _, usageBlock in ipairs(f.usage) do
76-
table.insert(md, "```lua run")
77-
-- Check if usageBlock is already multi-line
76+
table.insert(md, "```lua")
7877
if type(usageBlock) == "string" then
7978
if usageBlock:match("\n") then
80-
-- Multi-line block
8179
table.insert(md, usageBlock)
8280
else
83-
-- Single line
8481
table.insert(md, usageBlock)
8582
end
8683
end
@@ -165,7 +162,7 @@ function markdownGenerator.generate(ast)
165162
if class.usage then
166163
table.insert(md, "## Usage")
167164
for _, usageBlock in ipairs(class.usage) do
168-
table.insert(md, "```lua run")
165+
table.insert(md, "```lua")
169166
if type(usageBlock) == "string" then
170167
table.insert(md, usageBlock)
171168
end
@@ -174,6 +171,25 @@ function markdownGenerator.generate(ast)
174171
end
175172
end
176173

174+
if class.run then
175+
table.insert(md, "## Examples (Executable)")
176+
for _, runBlock in ipairs(class.run) do
177+
table.insert(md, "```lua run")
178+
if type(runBlock) == "string" then
179+
table.insert(md, runBlock)
180+
end
181+
table.insert(md, "```")
182+
table.insert(md, "")
183+
end
184+
end
185+
186+
if class.notes then
187+
for _, note in ipairs(class.notes) do
188+
table.insert(md, "> **Note:** " .. note)
189+
table.insert(md, "")
190+
end
191+
end
192+
177193
if #class.tableTypes > 0 then
178194
table.insert(md, "## Table Types")
179195
table.insert(md, "")

0 commit comments

Comments
 (0)