summaryrefslogtreecommitdiff
path: root/script-beta/provider/markdown.lua
blob: 874b3abd609b6ff75ee562489c22c28dc51c042c (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
    end
end

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

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