Skip to content

Commit a706be7

Browse files
feat: change code.border to thin instead of hide if version < 0.11.0
## Details This does not change behavior as previously if we failed to hide the border (which would happen on versions < 0.11.0), we would fallback to using a thin border. This change only makes this more visible (at the time of creating the configuration), and users will be able to see this if they run the `:RenderMarkdown config` command. This allows us to remove the fallback logic in the rendering step, instead we can now assume compatibility.
1 parent dde0cba commit a706be7

File tree

3 files changed

+17
-17
lines changed

3 files changed

+17
-17
lines changed

lua/render-markdown/health.lua

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ local state = require('render-markdown.state')
55
local M = {}
66

77
---@private
8-
M.version = '8.5.2'
8+
M.version = '8.5.3'
99

1010
function M.check()
1111
M.start('version')

lua/render-markdown/init.lua

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -128,11 +128,14 @@ function M.resolve_config(user)
128128
if config.indent.enabled then
129129
config.pipe_table.border_virtual = true
130130
end
131-
-- override settings that require neovim >= 0.10.0 and have compatible alternatives
132-
local has_10 = require('render-markdown.lib.compat').has_10
133-
if not has_10 then
131+
-- override settings incompatible with neovim version with compatible alternatives
132+
local Compat = require('render-markdown.lib.compat')
133+
if config.code.position == 'left' and not Compat.has_10 then
134134
config.code.position = 'right'
135135
end
136+
if config.code.border == 'hide' and not Compat.has_11 then
137+
config.code.border = 'thin'
138+
end
136139
-- use lazy.nvim file type configuration if available and no user value is specified
137140
if not user.file_types then
138141
local lazy_file_types = require('render-markdown.lib.env').lazy('ft')

lua/render-markdown/render/markdown/code.lua

Lines changed: 10 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -169,20 +169,17 @@ function Render:border(node, icon, empty)
169169
local row = node.start_row
170170
if kind == 'thick' or not empty then
171171
self:background(row, row, highlight)
172-
return
173-
end
174-
if kind == 'hide' then
175-
if self.marks:over(true, node, { conceal_lines = '' }) then
176-
return
177-
end
172+
elseif kind == 'hide' then
173+
self.marks:over(true, node, { conceal_lines = '' })
174+
else
175+
local col = self.node.start_col
176+
local block = self.config.width == 'block'
177+
local width = block and self.data.body - col or vim.o.columns
178+
self.marks:add('code_border', row, col, {
179+
virt_text = { { icon:rep(width), colors.bg_as_fg(highlight) } },
180+
virt_text_pos = 'overlay',
181+
})
178182
end
179-
local col = self.node.start_col
180-
local block = self.config.width == 'block'
181-
local width = block and self.data.body - col or vim.o.columns
182-
self.marks:add('code_border', row, col, {
183-
virt_text = { { icon:rep(width), colors.bg_as_fg(highlight) } },
184-
virt_text_pos = 'overlay',
185-
})
186183
end
187184

188185
---@private

0 commit comments

Comments
 (0)