Skip to content

Commit 5df2eab

Browse files
feat: use background for thick code border
## Details Previously we modified how code borders are generated to make them more configurable. Part of this change replaced the usage of the space `' '` as our padding character with a block `'█'`. This works for the most part but has a couple of problems: - requires inverting a highlight group which is more error prone - text behaves like foreground so does not play nicely with blending We now avoid doing this when adding `thick` borders, so use a space and avoid inverting the highlight group, `thin` borders keep old behavior.
1 parent eec00fb commit 5df2eab

File tree

4 files changed

+17
-8
lines changed

4 files changed

+17
-8
lines changed

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,10 @@
1010
- improve completions [#474](https://github.com/MeanderingProgrammer/render-markdown.nvim/pull/474)
1111
[3254863](https://github.com/MeanderingProgrammer/render-markdown.nvim/commit/3254863eb91fed3d9a7433b54327716528f1eacc)
1212

13+
### Bug Fixes
14+
15+
- resolve styles & presets in overrides [eec00fb](https://github.com/MeanderingProgrammer/render-markdown.nvim/commit/eec00fbfd7273cdfa0a1154dbef0bb983641eaf8)
16+
1317
### Collaborator Shoutouts
1418

1519
- @Anaritus

doc/render-markdown.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
*render-markdown.txt* For NVIM v0.11.3 Last change: 2025 July 31
1+
*render-markdown.txt* For NVIM v0.11.3 Last change: 2025 August 04
22

33
==============================================================================
44
Table of Contents *render-markdown-table-of-contents*

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.6.10'
8+
M.version = '8.6.11'
99

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

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

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -140,9 +140,10 @@ function Render:language(info, language, delim)
140140
return false
141141
end
142142

143-
local left = self:line():text(self.config.language_left, border_hl)
144-
local right = self:line():text(self.config.language_right, border_hl)
145-
local body = left:extend(text):extend(right)
143+
local body = self:line()
144+
:text(self.config.language_left, border_hl)
145+
:extend(text)
146+
:text(self.config.language_right, border_hl)
146147

147148
local border = border_hl and self.config.language_border or ' '
148149
local width = self.data.body - delim.start_col
@@ -180,11 +181,14 @@ function Render:border(node, thin)
180181
elseif kind == 'hide' then
181182
self.marks:over(true, node, { conceal_lines = '' })
182183
else
183-
local icon = kind == 'thin' and thin or ''
184+
local icon = kind == 'thin' and thin or ' '
185+
if icon ~= ' ' then
186+
highlight = colors.bg_as_fg(highlight)
187+
end
184188
local block = self.config.width == 'block'
185189
local width = block and self.data.body - node.start_col or vim.o.columns
186190
self.marks:start('code_border', node, {
187-
virt_text = { { icon:rep(width), colors.bg_as_fg(highlight) } },
191+
virt_text = { { icon:rep(width), highlight } },
188192
virt_text_pos = 'overlay',
189193
})
190194
end
@@ -234,7 +238,8 @@ end
234238
function Render:padding(background)
235239
local col = self.node.start_col
236240
local start_row, end_row = self.node.start_row, self.node.end_row - 1
237-
local empty, widths = {}, col == 0 and {} or self.node:widths()
241+
local empty = {} ---@type integer[]
242+
local widths = col == 0 and {} or self.node:widths()
238243
for i, width in ipairs(widths) do
239244
if width == 0 then
240245
empty[#empty + 1] = (start_row + i - 1)

0 commit comments

Comments
 (0)