Skip to content

Commit b8c3d47

Browse files
feat: more anti_conceal.ignore elements
## Details Adds to the `anti_conceal.ignore` element list: - `indent`: used for section indentation - `virtual_lines`: used for all virt_lines extmarks = latex, heading borders, table borders Both are added to the `ignore` table and set to `true` to keep all default behavior unchanged. Changes only occur if users actually set a custom value.
1 parent 1327150 commit b8c3d47

File tree

8 files changed

+59
-21
lines changed

8 files changed

+59
-21
lines changed

README.md

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -251,11 +251,23 @@ require('render-markdown').setup({
251251
-- Which elements to always show, ignoring anti conceal behavior. Values can either be
252252
-- booleans to fix the behavior or string lists representing modes where anti conceal
253253
-- behavior will be ignored. Valid values are:
254-
-- head_icon, head_background, head_border, code_language, code_background, code_border,
255-
-- dash, bullet, check_icon, check_scope, quote, table_border, callout, link, sign
254+
-- bullet
255+
-- callout
256+
-- check_icon, check_scope
257+
-- code_background, code_border, code_language
258+
-- dash
259+
-- head_background, head_border, head_icon
260+
-- indent
261+
-- link
262+
-- quote
263+
-- sign
264+
-- table_border
265+
-- virtual_lines
256266
ignore = {
257267
code_background = true,
268+
indent = true,
258269
sign = true,
270+
virtual_lines = true,
259271
},
260272
},
261273
padding = {

doc/render-markdown.txt

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -317,11 +317,23 @@ Default Configuration ~
317317
-- Which elements to always show, ignoring anti conceal behavior. Values can either be
318318
-- booleans to fix the behavior or string lists representing modes where anti conceal
319319
-- behavior will be ignored. Valid values are:
320-
-- head_icon, head_background, head_border, code_language, code_background, code_border,
321-
-- dash, bullet, check_icon, check_scope, quote, table_border, callout, link, sign
320+
-- bullet
321+
-- callout
322+
-- check_icon, check_scope
323+
-- code_background, code_border, code_language
324+
-- dash
325+
-- head_background, head_border, head_icon
326+
-- indent
327+
-- link
328+
-- quote
329+
-- sign
330+
-- table_border
331+
-- virtual_lines
322332
ignore = {
323333
code_background = true,
334+
indent = true,
324335
sign = true,
336+
virtual_lines = true,
325337
},
326338
},
327339
padding = {

lua/render-markdown/config/anti_conceal.lua

Lines changed: 26 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -9,21 +9,23 @@
99

1010
---@enum render.md.Element
1111
local Element = {
12-
head_icon = 'head_icon',
13-
head_background = 'head_background',
14-
head_border = 'head_border',
15-
code_language = 'code_language',
16-
code_background = 'code_background',
17-
code_border = 'code_border',
18-
dash = 'dash',
1912
bullet = 'bullet',
13+
callout = 'callout',
2014
check_icon = 'check_icon',
2115
check_scope = 'check_scope',
22-
quote = 'quote',
23-
table_border = 'table_border',
24-
callout = 'callout',
16+
code_background = 'code_background',
17+
code_border = 'code_border',
18+
code_language = 'code_language',
19+
dash = 'dash',
20+
head_background = 'head_background',
21+
head_border = 'head_border',
22+
head_icon = 'head_icon',
23+
indent = 'indent',
2524
link = 'link',
25+
quote = 'quote',
2626
sign = 'sign',
27+
table_border = 'table_border',
28+
virtual_lines = 'virtual_lines',
2729
}
2830

2931
---@class render.md.anti.conceal.Cfg
@@ -42,11 +44,23 @@ M.default = {
4244
-- Which elements to always show, ignoring anti conceal behavior. Values can either be
4345
-- booleans to fix the behavior or string lists representing modes where anti conceal
4446
-- behavior will be ignored. Valid values are:
45-
-- head_icon, head_background, head_border, code_language, code_background, code_border,
46-
-- dash, bullet, check_icon, check_scope, quote, table_border, callout, link, sign
47+
-- bullet
48+
-- callout
49+
-- check_icon, check_scope
50+
-- code_background, code_border, code_language
51+
-- dash
52+
-- head_background, head_border, head_icon
53+
-- indent
54+
-- link
55+
-- quote
56+
-- sign
57+
-- table_border
58+
-- virtual_lines
4759
ignore = {
4860
code_background = true,
61+
indent = true,
4962
sign = true,
63+
virtual_lines = true,
5064
},
5165
}
5266

lua/render-markdown/handler/latex.lua

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ function Handler:run(root)
5050
local row = above and node.start_row or node.end_row
5151

5252
local marks = Marks.new(self.context, true)
53-
marks:add(false, row, 0, {
53+
marks:add('virtual_lines', row, 0, {
5454
virt_lines = lines,
5555
virt_lines_above = above,
5656
})

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

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

lua/render-markdown/render/markdown/heading.lua

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -280,7 +280,7 @@ function Render:border(box, above)
280280
virt_text_pos = 'overlay',
281281
})
282282
else
283-
self.marks:add(false, self.node.start_row, 0, {
283+
self.marks:add('virtual_lines', self.node.start_row, 0, {
284284
virt_lines = {
285285
self:indent():line(true, self.data.level):extend(line):get(),
286286
},

lua/render-markdown/render/markdown/section.lua

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ function Render:run()
3737
-- each level stacks inline marks so we only add changes in level
3838
local line = self:indent():line(false, self.data.level_change):get()
3939
for row = start_row, end_row do
40-
self.marks:add(false, row, 0, {
40+
self.marks:add('indent', row, 0, {
4141
priority = self.config.priority,
4242
virt_text = line,
4343
virt_text_pos = 'inline',

lua/render-markdown/render/markdown/table.lua

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -405,7 +405,7 @@ function Render:border()
405405
virt_text_pos = 'overlay',
406406
})
407407
else
408-
self.marks:add(false, node.start_row, 0, {
408+
self.marks:add('virtual_lines', node.start_row, 0, {
409409
virt_lines = { self:indent():line(true):extend(line):get() },
410410
virt_lines_above = above,
411411
})

0 commit comments

Comments
 (0)