Skip to content

Commit c809fc1

Browse files
feat: change concealcursor value to nvic when user disables anti conceal
## Details Have received a few bug reports when users disable the anti conceal feature, then notice that while for some things it works, text that is concealed in any way still becomes visible. For example with checkboxes the original list marker becomes visible as shown here: #463 This is a reasonable expectation given the name of the feature but is a misunderstanding of what is doing what. This plugin is adding decorations using extmarks, when anti conceal is disabled we simply add the marks on all the line, when it's enabled we avoid adding marks on the current line. However conceal behavior on the current line is not controlled by this plugin directly, and is instead controlled by the concealcursor window option. Previously for these issues I would inform users to update their `win_options` configuration to set concealcursor to 'nvic'. At the same time since this is behavior the user is going for we may as well make it function that way out of the box for them, while still allowing them to override the value for more custom experiences. So the behavior now is if `anti_conceal.enabled == false`, the default value for `win_options.concealcursor.rendered` becomes `'nvic'` instead of `''`. This is handled similarly to a `preset`, even though that's not what it is a `preset` is really just a way of setting different default options based on the values of other options. If the user sets any value in their config for `win_options.concealcursor.rendered` that will always take priority and be used over the default.
1 parent 24aacee commit c809fc1

File tree

12 files changed

+110
-31
lines changed

12 files changed

+110
-31
lines changed

CHANGELOG.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,17 @@
55
### Features
66

77
- configurable language border [b8ee8bc](https://github.com/MeanderingProgrammer/render-markdown.nvim/commit/b8ee8bcefd6f5319beb7d3df5237c68e5c5376ac)
8+
- configurable left and right language text [ba50c2f](https://github.com/MeanderingProgrammer/render-markdown.nvim/commit/ba50c2fa9178a9b7e35c9410fb7c952bdf6de50e)
89
- change code.border to thin instead of hide if version < 0.11.0 [a706be7](https://github.com/MeanderingProgrammer/render-markdown.nvim/commit/a706be739257a6203524741da2da540bc190bbe2)
910
- allow image links to use custom icons based on destination [ac3e74f](https://github.com/MeanderingProgrammer/render-markdown.nvim/commit/ac3e74ffdb0bcf7282445ac12083fb6bd44858a1)
11+
- better support for reloading with lazy.nvim [24aacee](https://github.com/MeanderingProgrammer/render-markdown.nvim/commit/24aacee83544ca113055564ed22be7852067c342)
12+
13+
### Bug Fixes
14+
15+
- handle nil windows on WinResized [#455](https://github.com/MeanderingProgrammer/render-markdown.nvim/issues/455)
16+
[ec92f60](https://github.com/MeanderingProgrammer/render-markdown.nvim/commit/ec92f60b28be3e63007e62bb4084af5633eaf1d6)
17+
- correctly order indent & padding [#457](https://github.com/MeanderingProgrammer/render-markdown.nvim/issues/457)
18+
[0944ba0](https://github.com/MeanderingProgrammer/render-markdown.nvim/commit/0944ba04ea7fc9e9087c1dedc76562d6e0d110cf)
1019

1120
### Collaborator Shoutouts
1221

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.2 Last change: 2025 June 22
1+
*render-markdown.txt* For NVIM v0.11.2 Last change: 2025 June 27
22

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

lua/render-markdown/config/callout.lua

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
---@alias render.md.callout.Configs table<string, render.md.callout.Config>
2+
13
---@class (exact) render.md.callout.Config
24
---@field raw string
35
---@field rendered string
@@ -9,7 +11,7 @@
911
local M = {}
1012

1113
-- stylua: ignore
12-
---@type table<string, render.md.callout.Config>
14+
---@type render.md.callout.Configs
1315
M.default = {
1416
-- Callouts are a special instance of a 'block_quote' that start with a 'shortcut_link'.
1517
-- The key is for healthcheck and to allow users to change its values, value type below.

lua/render-markdown/config/injections.lua

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,13 @@
1+
---@alias render.md.injection.Configs table<string, render.md.injection.Config>
2+
13
---@class (exact) render.md.injection.Config
24
---@field enabled boolean
35
---@field query string
46

57
---@class render.md.injection.Cfg
68
local M = {}
79

8-
---@type table<string, render.md.injection.Config>
10+
---@type render.md.injection.Configs
911
M.default = {
1012
-- Out of the box language injections for known filetypes that allow markdown to be interpreted
1113
-- in specified locations, see :h treesitter-language-injections.

lua/render-markdown/config/patterns.lua

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
---@alias render.md.pattern.Configs table<string, render.md.pattern.Config>
2+
13
---@class (exact) render.md.pattern.Config
24
---@field disable boolean
35
---@field directives render.md.directive.Config[]
@@ -9,7 +11,7 @@
911
---@class render.md.pattern.Cfg
1012
local M = {}
1113

12-
---@type table<string, render.md.pattern.Config>
14+
---@type render.md.pattern.Configs
1315
M.default = {
1416
-- Highlight patterns to disable for filetypes, i.e. lines concealed around code blocks
1517

lua/render-markdown/config/win_options.lua

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
---@alias render.md.window.Configs table<string, render.md.window.Config>
2+
13
---@class (exact) render.md.window.Config
24
---@field default render.md.option.Value
35
---@field rendered render.md.option.Value
@@ -7,7 +9,7 @@
79
---@class render.md.window.Cfg
810
local M = {}
911

10-
---@type table<string, render.md.window.Config>
12+
---@type render.md.window.Configs
1113
M.default = {
1214
-- Window options to use that change between rendered and raw view.
1315

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

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

lua/render-markdown/init.lua

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@ local M = {}
88
---@field file_types string[]
99
---@field ignore fun(buf: integer): boolean
1010
---@field change_events string[]
11-
---@field injections table<string, render.md.injection.Config>
12-
---@field patterns table<string, render.md.pattern.Config>
11+
---@field injections render.md.injection.Configs
12+
---@field patterns render.md.pattern.Configs
1313
---@field on render.md.on.Config
1414
---@field completions render.md.completions.Config
1515
---@field overrides render.md.overrides.Config
@@ -20,7 +20,7 @@ local M = {}
2020
---@field debounce integer
2121
---@field anti_conceal render.md.anti.conceal.Config
2222
---@field bullet render.md.bullet.Config
23-
---@field callout table<string, render.md.callout.Config>
23+
---@field callout render.md.callout.Configs
2424
---@field checkbox render.md.checkbox.Config
2525
---@field code render.md.code.Config
2626
---@field dash render.md.dash.Config
@@ -36,7 +36,7 @@ local M = {}
3636
---@field pipe_table render.md.table.Config
3737
---@field quote render.md.quote.Config
3838
---@field sign render.md.sign.Config
39-
---@field win_options table<string, render.md.window.Config>
39+
---@field win_options render.md.window.Configs
4040

4141
---@private
4242
---@type boolean

lua/render-markdown/lib/presets.lua

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,10 @@ local M = {}
1111
---@param user render.md.UserConfig
1212
---@return render.md.UserConfig
1313
function M.get(user)
14+
-- NOTE: only works while no options overlap
1415
local config = M.config(user.preset)
1516
config.pipe_table = M.pipe_table((user.pipe_table or {}).preset)
17+
config.win_options = M.win_options((user.anti_conceal or {}).enabled)
1618
return config
1719
end
1820

@@ -93,4 +95,17 @@ function M.pipe_table(preset)
9395
end
9496
end
9597

98+
---@private
99+
---@param anti_conceal? boolean
100+
---@return render.md.window.UserConfigs
101+
function M.win_options(anti_conceal)
102+
if anti_conceal == false then
103+
---@type render.md.window.UserConfigs
104+
return { concealcursor = { rendered = 'nvic' } }
105+
else
106+
---@type render.md.window.UserConfigs
107+
return {}
108+
end
109+
end
110+
96111
return M

lua/render-markdown/types.lua

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@
77
---@field file_types? string[]
88
---@field ignore? fun(buf: integer): boolean
99
---@field change_events? string[]
10-
---@field injections? table<string, render.md.injection.UserConfig>
11-
---@field patterns? table<string, render.md.pattern.UserConfig>
10+
---@field injections? render.md.injection.UserConfigs
11+
---@field patterns? render.md.pattern.UserConfigs
1212
---@field on? render.md.on.UserConfig
1313
---@field completions? render.md.completions.UserConfig
1414
---@field overrides? render.md.overrides.UserConfig
@@ -19,7 +19,7 @@
1919
---@field debounce? integer
2020
---@field anti_conceal? render.md.anti.conceal.UserConfig
2121
---@field bullet? render.md.bullet.UserConfig
22-
---@field callout? table<string, render.md.callout.UserConfig>
22+
---@field callout? render.md.callout.UserConfigs
2323
---@field checkbox? render.md.checkbox.UserConfig
2424
---@field code? render.md.code.UserConfig
2525
---@field dash? render.md.dash.UserConfig
@@ -35,7 +35,7 @@
3535
---@field pipe_table? render.md.table.UserConfig
3636
---@field quote? render.md.quote.UserConfig
3737
---@field sign? render.md.sign.UserConfig
38-
---@field win_options? table<string, render.md.window.UserConfig>
38+
---@field win_options? render.md.window.UserConfigs
3939

4040
---@class (exact) render.md.anti.conceal.UserConfig
4141
---@field enabled? boolean
@@ -56,6 +56,8 @@
5656
---@field highlight? render.md.bullet.String
5757
---@field scope_highlight? render.md.bullet.String
5858

59+
---@alias render.md.callout.UserConfigs table<string, render.md.callout.UserConfig>
60+
5961
---@class (exact) render.md.callout.UserConfig
6062
---@field raw? string
6163
---@field rendered? string
@@ -174,6 +176,8 @@
174176
---@field icon? string
175177
---@field highlight? string
176178

179+
---@alias render.md.injection.UserConfigs table<string, render.md.injection.UserConfig>
180+
177181
---@class (exact) render.md.injection.UserConfig
178182
---@field enabled? boolean
179183
---@field query? string
@@ -234,6 +238,8 @@
234238
---@field indent? render.md.paragraph.Number
235239
---@field min_width? integer
236240

241+
---@alias render.md.pattern.UserConfigs table<string, render.md.pattern.UserConfig>
242+
237243
---@class (exact) render.md.pattern.UserConfig
238244
---@field disable? boolean
239245
---@field directives? render.md.directive.UserConfig[]
@@ -264,6 +270,8 @@
264270
---@field enabled? boolean
265271
---@field highlight? string
266272

273+
---@alias render.md.window.UserConfigs table<string, render.md.window.UserConfig>
274+
267275
---@class (exact) render.md.window.UserConfig
268276
---@field default? render.md.option.Value
269277
---@field rendered? render.md.option.Value

0 commit comments

Comments
 (0)