Skip to content

Commit 240de21

Browse files
Rename variables to be more specific to text being placed
1 parent c1a3421 commit 240de21

File tree

3 files changed

+16
-16
lines changed

3 files changed

+16
-16
lines changed

lua/render-markdown/handler/latex.lua

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,13 +33,13 @@ M.render = function(namespace, root, buf)
3333
cache.expressions[value] = expressions
3434
end
3535

36-
local virt_lines = vim.tbl_map(function(expression)
36+
local latex_lines = vim.tbl_map(function(expression)
3737
return { { expression, state.config.highlights.latex } }
3838
end, expressions)
3939
vim.api.nvim_buf_set_extmark(buf, namespace, start_row, start_col, {
4040
end_row = end_row,
4141
end_col = end_col,
42-
virt_lines = virt_lines,
42+
virt_lines = latex_lines,
4343
virt_lines_above = true,
4444
})
4545
end

lua/render-markdown/handler/markdown.lua

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -28,20 +28,20 @@ M.render = function(namespace, root, buf)
2828
local background = list.clamp_last(highlights.heading.backgrounds, level)
2929
local foreground = list.clamp_last(highlights.heading.foregrounds, level)
3030

31-
local virt_text = { string.rep(' ', padding) .. heading, { foreground, background } }
31+
local heading_text = { string.rep(' ', padding) .. heading, { foreground, background } }
3232
vim.api.nvim_buf_set_extmark(buf, namespace, start_row, 0, {
3333
end_row = end_row + 1,
3434
end_col = 0,
3535
hl_group = background,
36-
virt_text = { virt_text },
36+
virt_text = { heading_text },
3737
virt_text_pos = 'overlay',
3838
hl_eol = true,
3939
})
4040
elseif capture == 'dash' then
4141
local width = vim.api.nvim_win_get_width(util.buf_to_win(buf))
42-
local virt_text = { state.config.dash:rep(width), highlights.dash }
42+
local dash_text = { state.config.dash:rep(width), highlights.dash }
4343
vim.api.nvim_buf_set_extmark(buf, namespace, start_row, 0, {
44-
virt_text = { virt_text },
44+
virt_text = { dash_text },
4545
virt_text_pos = 'overlay',
4646
})
4747
elseif capture == 'code' then
@@ -67,11 +67,11 @@ M.render = function(namespace, root, buf)
6767
local level = M.calculate_list_level(node)
6868
local bullet = list.cycle(state.config.bullets, level)
6969

70-
local virt_text = { string.rep(' ', leading_spaces or 0) .. bullet, highlights.bullet }
70+
local list_marker_text = { string.rep(' ', leading_spaces or 0) .. bullet, highlights.bullet }
7171
vim.api.nvim_buf_set_extmark(buf, namespace, start_row, start_col, {
7272
end_row = end_row,
7373
end_col = end_col,
74-
virt_text = { virt_text },
74+
virt_text = { list_marker_text },
7575
virt_text_pos = 'overlay',
7676
})
7777
end
@@ -86,11 +86,11 @@ M.render = function(namespace, root, buf)
8686
end
8787
end
8888

89-
local virt_text = { value:gsub('>', state.config.quote), highlight }
89+
local quote_marker_text = { value:gsub('>', state.config.quote), highlight }
9090
vim.api.nvim_buf_set_extmark(buf, namespace, start_row, start_col, {
9191
end_row = end_row,
9292
end_col = end_col,
93-
virt_text = { virt_text },
93+
virt_text = { quote_marker_text },
9494
virt_text_pos = 'overlay',
9595
})
9696
elseif vim.tbl_contains({ 'checkbox_unchecked', 'checkbox_checked' }, capture) then
@@ -103,11 +103,11 @@ M.render = function(namespace, root, buf)
103103
local padding = vim.fn.strdisplaywidth(value) - vim.fn.strdisplaywidth(checkbox)
104104

105105
if padding >= 0 then
106-
local virt_text = { string.rep(' ', padding) .. checkbox, highlight }
106+
local checkbox_text = { string.rep(' ', padding) .. checkbox, highlight }
107107
vim.api.nvim_buf_set_extmark(buf, namespace, start_row, start_col, {
108108
end_row = end_row,
109109
end_col = end_col,
110-
virt_text = { virt_text },
110+
virt_text = { checkbox_text },
111111
virt_text_pos = 'overlay',
112112
})
113113
end
@@ -152,11 +152,11 @@ M.render = function(namespace, root, buf)
152152
highlight = highlights.table.row
153153
end
154154

155-
local virt_text = { row, highlight }
155+
local table_row_text = { row, highlight }
156156
vim.api.nvim_buf_set_extmark(buf, namespace, start_row, start_col, {
157157
end_row = end_row,
158158
end_col = end_col,
159-
virt_text = { virt_text },
159+
virt_text = { table_row_text },
160160
virt_text_pos = 'overlay',
161161
})
162162
end

lua/render-markdown/handler/markdown_inline.lua

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,11 +24,11 @@ M.render = function(namespace, root, buf)
2424
elseif capture == 'callout' then
2525
local key = callout.get_key_exact(value)
2626
if key ~= nil then
27-
local virt_text = { state.config.callout[key], highlights.callout[key] }
27+
local callout_text = { state.config.callout[key], highlights.callout[key] }
2828
vim.api.nvim_buf_set_extmark(buf, namespace, start_row, start_col, {
2929
end_row = end_row,
3030
end_col = end_col,
31-
virt_text = { virt_text },
31+
virt_text = { callout_text },
3232
virt_text_pos = 'overlay',
3333
})
3434
end

0 commit comments

Comments
 (0)