Skip to content

Commit

Permalink
fix(markdown): code block, rule, codeblock should only render one rule
Browse files Browse the repository at this point in the history
  • Loading branch information
folke committed Oct 27, 2022
1 parent 0bf5f9e commit feb8e4d
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion lua/noice/text/markdown.lua
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,9 @@ function M.format(message, text)
local lines = vim.split(vim.trim(text), "\n")
lines = M.trim(lines)

text = table.concat(lines, "\n")
vim.notify(text)

for l, line in ipairs(lines) do
local prev = lines[l - 1]
local next = lines[l + 1]
Expand All @@ -63,7 +66,7 @@ function M.format(message, text)
if l ~= 1 then
message:newline()
end
if M.is_code_block(line) and M.is_rule(prev) then
if M.is_code_block(line) and M.is_rule(prev) and not M.is_code_block(lines[l - 2]) then
M.horizontal_line(message)
end
-- Make the horizontal ruler extend the whole window width
Expand Down

0 comments on commit feb8e4d

Please sign in to comment.