From fa25007de6092de2f6db159bd7e1c0d499c5403c Mon Sep 17 00:00:00 2001 From: Robert Jelic <36573031+NoryiE@users.noreply.github.com> Date: Thu, 30 Oct 2025 08:20:28 +0100 Subject: [PATCH] Generation fix --- tools/BasaltDoc/utils/markdownGenerator.lua | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/tools/BasaltDoc/utils/markdownGenerator.lua b/tools/BasaltDoc/utils/markdownGenerator.lua index 528a4e7..400a5bf 100644 --- a/tools/BasaltDoc/utils/markdownGenerator.lua +++ b/tools/BasaltDoc/utils/markdownGenerator.lua @@ -16,6 +16,13 @@ local function processDescription(description) return table.concat(lines, "\n") end +local function escapeInlineCode(text) + if not text then return text end + text = text:gsub("({%b[]})", "`%1`") + text = text:gsub("(%b[]%s*=%s*[^%s,}]+)", "`%1`") + return text +end + local function generateFunctionMarkdown(class, functions) local md = {} @@ -48,7 +55,7 @@ local function generateFunctionMarkdown(class, functions) if p.optional then paramLine = paramLine .. " *(optional)*" end paramLine = paramLine .. " `" .. p.type .. "`" if p.description and p.description ~= "" then - paramLine = paramLine .. " " .. p.description + paramLine = paramLine .. " " .. escapeInlineCode(p.description) end table.insert(md, paramLine) end @@ -63,7 +70,7 @@ local function generateFunctionMarkdown(class, functions) returnLine = returnLine .. " `" .. r.name .. "`" end if r.description and r.description ~= "" then - returnLine = returnLine .. " " .. r.description + returnLine = returnLine .. " " .. escapeInlineCode(r.description) end table.insert(md, returnLine) end