aboutsummaryrefslogtreecommitdiff
path: root/runtime/lua/vim/lsp/util.lua
diff options
context:
space:
mode:
authorFolke Lemaitre <folke.lemaitre@gmail.com>2022-12-03 13:51:57 +0100
committerGitHub <noreply@github.com>2022-12-03 13:51:57 +0100
commitc768b578faba671beab435954dc4e5a321c94728 (patch)
tree7f5e7278bffd9786f82f76208f041df8d9d0bce3 /runtime/lua/vim/lsp/util.lua
parent8f1ef3687554b25c46486f4a67df75cad9ae7357 (diff)
downloadrneovim-c768b578faba671beab435954dc4e5a321c94728.tar.gz
rneovim-c768b578faba671beab435954dc4e5a321c94728.tar.bz2
rneovim-c768b578faba671beab435954dc4e5a321c94728.zip
fix(lsp): render <pre>{lang} code blocks and set separator default to false (#21271)
Diffstat (limited to 'runtime/lua/vim/lsp/util.lua')
-rw-r--r--runtime/lua/vim/lsp/util.lua6
1 files changed, 2 insertions, 4 deletions
diff --git a/runtime/lua/vim/lsp/util.lua b/runtime/lua/vim/lsp/util.lua
index ba9f145e01..e96e98f23c 100644
--- a/runtime/lua/vim/lsp/util.lua
+++ b/runtime/lua/vim/lsp/util.lua
@@ -1261,7 +1261,7 @@ function M.stylize_markdown(bufnr, contents, opts)
-- when ft is nil, we get the ft from the regex match
local matchers = {
block = { nil, '```+([a-zA-Z0-9_]*)', '```+' },
- pre = { '', '<pre>', '</pre>' },
+ pre = { nil, '<pre>([a-z0-9]*)', '</pre>' },
code = { '', '<code>', '</code>' },
text = { 'text', '<text>', '</text>' },
}
@@ -1286,8 +1286,6 @@ function M.stylize_markdown(bufnr, contents, opts)
-- Clean up
contents = M._trim(contents, opts)
- -- Insert blank line separator after code block?
- local add_sep = opts.separator == nil and true or opts.separator
local stripped = {}
local highlights = {}
-- keep track of lnums that contain markdown
@@ -1315,7 +1313,7 @@ function M.stylize_markdown(bufnr, contents, opts)
finish = #stripped,
})
-- add a separator, but not on the last line
- if add_sep and i < #contents then
+ if opts.separator and i < #contents then
table.insert(stripped, '---')
markdown_lines[#stripped] = true
end