summaryrefslogtreecommitdiff
path: root/script-beta/provider/markdown.lua
blob: 56e7d8f10bebc92a2bd9885df55e6e17d0a99794 (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 or #text == 0 then
        return
    end
    if language == 'md' then
        self[#self+1] = text
    else
        self[#self+1] = ('```%s\n%s\n```'):format(language, text)
    end
end

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

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