summaryrefslogtreecommitdiff
path: root/server-beta/src/provider/markdown.lua
diff options
context:
space:
mode:
Diffstat (limited to 'server-beta/src/provider/markdown.lua')
-rw-r--r--server-beta/src/provider/markdown.lua22
1 files changed, 22 insertions, 0 deletions
diff --git a/server-beta/src/provider/markdown.lua b/server-beta/src/provider/markdown.lua
new file mode 100644
index 00000000..0f69ad87
--- /dev/null
+++ b/server-beta/src/provider/markdown.lua
@@ -0,0 +1,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