summaryrefslogtreecommitdiff
path: root/script-beta/provider/markdown.lua
diff options
context:
space:
mode:
author最萌小汐 <sumneko@hotmail.com>2019-11-23 00:05:30 +0800
committer最萌小汐 <sumneko@hotmail.com>2019-11-23 00:05:30 +0800
commit6da2b175e20ed3c03b0dfcfc9046de1e0e5d4444 (patch)
treefdc22d78150fd1c5edc46732c8b151ccfefb519f /script-beta/provider/markdown.lua
parentd0ff66c9abe9d6abbca12fd811e0c3cb69c1033a (diff)
downloadlua-language-server-6da2b175e20ed3c03b0dfcfc9046de1e0e5d4444.zip
正路目录
Diffstat (limited to 'script-beta/provider/markdown.lua')
-rw-r--r--script-beta/provider/markdown.lua22
1 files changed, 22 insertions, 0 deletions
diff --git a/script-beta/provider/markdown.lua b/script-beta/provider/markdown.lua
new file mode 100644
index 00000000..0f69ad87
--- /dev/null
+++ b/script-beta/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