Skip to content

Commit 948be2d

Browse files
chore: remove code background priority override in nofile buffers
## Details The override is no longer necessary since the default has been updated for all buffers from `nil` to `140`. I agree with the reasoning in [#581](#581) that the value should also be lower than diagnostics by default. Fix some unit tests and update docs as well.
1 parent 0556144 commit 948be2d

8 files changed

Lines changed: 28 additions & 28 deletions

File tree

CHANGELOG.md

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,16 +11,19 @@
1111
- add more YouTube domains [#569](https://github.com/MeanderingProgrammer/render-markdown.nvim/pull/569)
1212
- allow html.comment.text to be a function [#574](https://github.com/MeanderingProgrammer/render-markdown.nvim/issues/574)
1313
[acddb80](https://github.com/MeanderingProgrammer/render-markdown.nvim/commit/acddb80d9a12e33c03ca288de39c9963396f358a)
14+
- add priority option for dash [#579](https://github.com/MeanderingProgrammer/render-markdown.nvim/issues/579)
15+
[da6a7b2](https://github.com/MeanderingProgrammer/render-markdown.nvim/commit/da6a7b25471ab23824f3429225973186eb0b62d2)
1416

1517
### Bug Fixes
1618

1719
- handle double width glyph checkboxes [#553](https://github.com/MeanderingProgrammer/render-markdown.nvim/issues/553)
1820
[f58c05f](https://github.com/MeanderingProgrammer/render-markdown.nvim/commit/f58c05f349d6e7650f4b40b0df1514400f0c10de)
1921
- link icons following long checkboxes [#564](https://github.com/MeanderingProgrammer/render-markdown.nvim/issues/564)
2022
[b2b1353](https://github.com/MeanderingProgrammer/render-markdown.nvim/commit/b2b135347e299ffbf7f4123fb7811899b0c9f4b8)
21-
- reduce code background priority in nofile buffers [26097a4](https://github.com/MeanderingProgrammer/render-markdown.nvim/commit/26097a4eb95b391d0308c1b77cce89b28bbc9916)
2223
- ignore inline highlights that start or end in nested node [#568](https://github.com/MeanderingProgrammer/render-markdown.nvim/issues/568)
2324
[7a43c8b](https://github.com/MeanderingProgrammer/render-markdown.nvim/commit/7a43c8b444fa15b7736b34b248addb951126f723)
25+
- reduce code background priority in nofile buffers [26097a4](https://github.com/MeanderingProgrammer/render-markdown.nvim/commit/26097a4eb95b391d0308c1b77cce89b28bbc9916)
26+
- lower priority for code highlights in all buffers [#581](https://github.com/MeanderingProgrammer/render-markdown.nvim/pull/581)
2427

2528
### Collaborator Shoutouts
2629

README.md

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -508,7 +508,7 @@ require('render-markdown').setup({
508508
-- Padding to add to the left & right of inline code.
509509
inline_pad = 0,
510510
-- Priority to assign to code background highlight.
511-
priority = nil,
511+
priority = 140,
512512
-- Highlight for code blocks.
513513
highlight = 'RenderMarkdownCode',
514514
-- Highlight for code info section, after the language.
@@ -942,7 +942,6 @@ require('render-markdown').setup({
942942
buftype = {
943943
nofile = {
944944
render_modes = true,
945-
code = { priority = 175 },
946945
padding = { highlight = 'NormalFloat' },
947946
sign = { enabled = false },
948947
},
@@ -1193,7 +1192,7 @@ require('render-markdown').setup({
11931192
-- Padding to add to the left & right of inline code.
11941193
inline_pad = 0,
11951194
-- Priority to assign to code background highlight.
1196-
priority = nil,
1195+
priority = 140,
11971196
-- Highlight for code blocks.
11981197
highlight = 'RenderMarkdownCode',
11991198
-- Highlight for code info section, after the language.

doc/render-markdown.txt

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
*render-markdown.txt* For NVIM v0.11.5 Last change: 2026 January 03
1+
*render-markdown.txt* For NVIM v0.11.5 Last change: 2026 January 07
22

33
==============================================================================
44
Table of Contents *render-markdown-table-of-contents*
@@ -574,7 +574,7 @@ Default Configuration ~
574574
-- Padding to add to the left & right of inline code.
575575
inline_pad = 0,
576576
-- Priority to assign to code background highlight.
577-
priority = nil,
577+
priority = 140,
578578
-- Highlight for code blocks.
579579
highlight = 'RenderMarkdownCode',
580580
-- Highlight for code info section, after the language.
@@ -1008,7 +1008,6 @@ Default Configuration ~
10081008
buftype = {
10091009
nofile = {
10101010
render_modes = true,
1011-
code = { priority = 175 },
10121011
padding = { highlight = 'NormalFloat' },
10131012
sign = { enabled = false },
10141013
},
@@ -1253,7 +1252,7 @@ Code Block Configuration ~
12531252
-- Padding to add to the left & right of inline code.
12541253
inline_pad = 0,
12551254
-- Priority to assign to code background highlight.
1256-
priority = nil,
1255+
priority = 140,
12571256
-- Highlight for code blocks.
12581257
highlight = 'RenderMarkdownCode',
12591258
-- Highlight for code info section, after the language.

lua/render-markdown/health.lua

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

88
---@private
9-
M.version = '8.10.11'
9+
M.version = '8.10.12'
1010

1111
function M.check()
1212
M.start('versions')

lua/render-markdown/settings.lua

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -404,7 +404,7 @@ M.code = {}
404404
---@field inline_left string
405405
---@field inline_right string
406406
---@field inline_pad integer
407-
---@field priority? integer
407+
---@field priority integer
408408
---@field highlight string
409409
---@field highlight_info string
410410
---@field highlight_language? string
@@ -562,7 +562,7 @@ function M.code.schema()
562562
inline_left = { type = 'string' },
563563
inline_right = { type = 'string' },
564564
inline_pad = { type = 'number' },
565-
priority = { optional = true, type = 'number' },
565+
priority = { type = 'number' },
566566
highlight = { type = 'string' },
567567
highlight_info = { type = 'string' },
568568
highlight_language = { optional = true, type = 'string' },
@@ -1431,7 +1431,6 @@ M.overrides.default = {
14311431
buftype = {
14321432
nofile = {
14331433
render_modes = true,
1434-
code = { priority = 175 },
14351434
padding = { highlight = 'NormalFloat' },
14361435
sign = { enabled = false },
14371436
},

scripts/generate.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ def main(force: bool) -> None:
4848
sizes: dict[str, int] = dict(small=10, medium=100, large=1000)
4949
for generator in generators:
5050
for size, n in sizes.items():
51-
path = Path("temp").joinpath(generator.name(size))
51+
path = Path("temp") / generator.name(size)
5252
if not path.exists() or force:
5353
sections = generator.create(n)
5454
content = "\n\n".join(["\n".join(section) for section in sections])

scripts/update.py

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -93,26 +93,26 @@ def main() -> None:
9393

9494

9595
def update_types(root: Path) -> None:
96-
files: list[Path] = [
97-
root.joinpath("init.lua"),
98-
root.joinpath("settings.lua"),
96+
files = [
97+
root / "init.lua",
98+
root / "settings.lua",
9999
]
100100

101-
sections: list[str] = ["---@meta"]
101+
sections = ["---@meta"]
102102
for lua_type in get_lua_types(files):
103103
user = lua_type.to_user()
104104
if user is not None:
105105
sections.append(user)
106106

107-
types = root.joinpath("types.lua")
107+
types = root / "types.lua"
108108
types.write_text("\n\n".join(sections) + "\n")
109109

110110

111111
def update_readme(root: Path) -> None:
112112
readme = Path("README.md")
113-
settings = root.joinpath("settings.lua")
113+
settings = root / "settings.lua"
114114
old = get_code_block(readme, "log_level", 1)
115-
new = wrap_setup(root, get_default(root.joinpath("init.lua"), None))
115+
new = wrap_setup(root, get_default(root / "init.lua", None))
116116
while True:
117117
match = re.search(r"settings\.(.*?)\.default", new)
118118
if match is None:
@@ -151,9 +151,9 @@ def wrap_setup(root: Path, s: str) -> str:
151151

152152

153153
def update_handlers(root: Path) -> None:
154-
files: list[Path] = [
155-
root.joinpath("settings.lua"),
156-
root.joinpath("lib/marks.lua"),
154+
files = [
155+
root / "settings.lua",
156+
root / "lib/marks.lua",
157157
]
158158
lua_types = {lua_type.name(): lua_type for lua_type in get_lua_types(files)}
159159
names = [
@@ -197,13 +197,13 @@ def get_lua_types(files: list[Path]) -> list[LuaType]:
197197

198198

199199
def get_config_for(config: str, parameter: str) -> str:
200-
lines: list[str] = config.splitlines()
201-
start: int = lines.index(f" {parameter} = {{")
200+
lines = config.splitlines()
201+
start = lines.index(f" {parameter} = {{")
202202
for i in range(start - 1, 0, -1):
203203
if "--" not in lines[i]:
204204
start = i + 1
205205
break
206-
end: int = lines.index(" },", start)
206+
end = lines.index(" },", start)
207207
return "\n".join(["{"] + lines[start : end + 1] + ["}"])
208208

209209

tests/util.lua

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ function M.highlight(kind)
7979
local priority ---@type integer?
8080
local highlight ---@type string
8181
if kind == 'code' then
82-
priority = vim.bo.buftype == 'nofile' and 175 or nil
82+
priority = 140
8383
highlight = 'RmCodeInline'
8484
elseif kind == 'inline' then
8585
highlight = 'RmInlineHighlight'
@@ -313,7 +313,7 @@ end
313313
function M.code.bg()
314314
---@type vim.api.keyset.set_extmark
315315
return {
316-
priority = vim.bo.buftype == 'nofile' and 175 or nil,
316+
priority = 140,
317317
hl_eol = true,
318318
hl_group = 'RmCode',
319319
}

0 commit comments

Comments
 (0)