summaryrefslogtreecommitdiff
path: root/server-beta/src/provider/markdown.lua
blob: 0f69ad876f346b72b7b3e1e8877b1863029b9be6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
local mt = {}
mt.__index = mt
mt.__name = 'markdown'

function mt:add(language, text)
    if not text then
        return
    end
    if language == 'lua' then
        self[#self+1] = ('```lua\n%s\n```'):format(text)
    else
        self[#self+1] = text:gsub('\n', '\n\n')
    end
end

function mt:string()
    return table.concat(self, '\n')
end

return function ()
    return setmetatable({}, mt)
end