summaryrefslogtreecommitdiff
path: root/script/provider/markdown.lua
diff options
context:
space:
mode:
author最萌小汐 <sumneko@hotmail.com>2021-08-19 21:13:37 +0800
committer最萌小汐 <sumneko@hotmail.com>2021-08-19 21:13:37 +0800
commit666d25e294d41d7ec7450ff34e5cc3eb1463d3da (patch)
tree027bd0a8e8f682809d8e330095eaa06876d9716a /script/provider/markdown.lua
parent7829753fb9951f2de05a3ebec0e94b3164eb6b46 (diff)
downloadlua-language-server-666d25e294d41d7ec7450ff34e5cc3eb1463d3da.zip
improve markdown
Diffstat (limited to 'script/provider/markdown.lua')
-rw-r--r--script/provider/markdown.lua17
1 files changed, 12 insertions, 5 deletions
diff --git a/script/provider/markdown.lua b/script/provider/markdown.lua
index 7b94157e..140267d7 100644
--- a/script/provider/markdown.lua
+++ b/script/provider/markdown.lua
@@ -58,9 +58,7 @@ function mt:string()
elseif obj.type == 'markdown' then
concat(obj.markdown)
else
- if obj.language == language then
- lines[#lines+1] = obj.text
- else
+ if obj.language ~= language then
if language ~= 'md' then
lines[#lines+1] = '```'
end
@@ -70,9 +68,18 @@ function mt:string()
if obj.language ~= 'md' then
lines[#lines+1] = '```' .. obj.language
end
- lines[#lines+1] = obj.text
- language = obj.language
end
+ if obj.language == 'md' and #lines > 0 then
+ local last = lines[#lines]
+ if obj.text:sub(1, 1) == '@'
+ or last:sub(1, 1) == '@' then
+ if lines[#lines] ~= '' then
+ lines[#lines+1] = ''
+ end
+ end
+ end
+ lines[#lines+1] = obj.text
+ language = obj.language
end
end
end