Skip to content

Commit 6f5a4c3

Browse files
chore(refactor): separate width enums for heading and code configurations
1 parent dd62056 commit 6f5a4c3

22 files changed

+39
-49
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
[a1b0988](https://github.com/MeanderingProgrammer/render-markdown.nvim/commit/a1b0988f5ab26698afb56b9c2f0525a4de1195c1)
1212
- include highlight query files in checkhealth [4f05de7](https://github.com/MeanderingProgrammer/render-markdown.nvim/commit/4f05de7536571e231b66dd0363af347b162b5fd7)
1313
- pad suffix of latex so backgrounds are aligned [a212596](https://github.com/MeanderingProgrammer/render-markdown.nvim/commit/a2125961287c78dfc03cb628b7bed7f91b70fd45)
14+
- allow anti conceal to be disabled in specific modes [dd62056](https://github.com/MeanderingProgrammer/render-markdown.nvim/commit/dd620561843d5a62c917fffe77f2923c965d12c7)
1415

1516
### Bug Fixes
1617

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

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

lua/render-markdown/config/base.lua

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,6 @@
77
---@class render.md.base.Cfg
88
local M = {}
99

10-
---@enum render.md.base.Width
11-
M.Width = {
12-
full = 'full',
13-
block = 'block',
14-
}
15-
1610
---@param spec render.md.debug.ValidatorSpec
1711
function M.validate(spec)
1812
spec:type('enabled', 'boolean')

lua/render-markdown/config/bullet.lua

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -68,8 +68,7 @@ M.default = {
6868

6969
---@param spec render.md.debug.ValidatorSpec
7070
function M.validate(spec)
71-
local Base = require('render-markdown.config.base')
72-
Base.validate(spec)
71+
require('render-markdown.config.base').validate(spec)
7372
spec:nested_list('icons', 'string', 'function')
7473
spec:nested_list('ordered_icons', 'string', 'function')
7574
spec:type('left_pad', { 'number', 'function' })

lua/render-markdown/config/checkbox.lua

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -63,8 +63,7 @@ M.default = {
6363

6464
---@param spec render.md.debug.ValidatorSpec
6565
function M.validate(spec)
66-
local Base = require('render-markdown.config.base')
67-
Base.validate(spec)
66+
require('render-markdown.config.base').validate(spec)
6867
spec:type('bullet', 'boolean')
6968
spec:type('right_pad', 'number')
7069
spec:nested({ 'unchecked', 'checked' }, function(box)

lua/render-markdown/config/code.lua

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
---@field language_icon boolean
77
---@field language_name boolean
88
---@field disable_background boolean|string[]
9-
---@field width render.md.base.Width
9+
---@field width render.md.code.Width
1010
---@field left_margin number
1111
---@field left_pad number
1212
---@field right_pad number
@@ -37,6 +37,12 @@ local Position = {
3737
right = 'right',
3838
}
3939

40+
---@enum render.md.code.Width
41+
local Width = {
42+
full = 'full',
43+
block = 'block',
44+
}
45+
4046
---@enum render.md.code.Border
4147
local Border = {
4248
hide = 'hide',
@@ -124,16 +130,15 @@ M.default = {
124130

125131
---@param spec render.md.debug.ValidatorSpec
126132
function M.validate(spec)
127-
local Base = require('render-markdown.config.base')
128-
Base.validate(spec)
133+
require('render-markdown.config.base').validate(spec)
129134
spec:type('sign', 'boolean')
130135
spec:one_of('style', vim.tbl_values(Style))
131136
spec:one_of('position', vim.tbl_values(Position))
132137
spec:type('language_pad', 'number')
133138
spec:type('language_icon', 'boolean')
134139
spec:type('language_name', 'boolean')
135140
spec:list('disable_background', 'string', 'boolean')
136-
spec:one_of('width', vim.tbl_values(Base.Width))
141+
spec:one_of('width', vim.tbl_values(Width))
137142
spec:type('left_margin', 'number')
138143
spec:type('left_pad', 'number')
139144
spec:type('right_pad', 'number')

lua/render-markdown/config/dash.lua

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,7 @@ M.default = {
3232

3333
---@param spec render.md.debug.ValidatorSpec
3434
function M.validate(spec)
35-
local Base = require('render-markdown.config.base')
36-
Base.validate(spec)
35+
require('render-markdown.config.base').validate(spec)
3736
spec:type('icon', 'string')
3837
spec:one_of('width', { 'full' }, 'number')
3938
spec:type('left_margin', 'number')

lua/render-markdown/config/document.lua

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,7 @@ M.default = {
2626

2727
---@param spec render.md.debug.ValidatorSpec
2828
function M.validate(spec)
29-
local Base = require('render-markdown.config.base')
30-
Base.validate(spec)
29+
require('render-markdown.config.base').validate(spec)
3130
spec:nested('conceal', function(conceal)
3231
conceal:list('char_patterns', 'string')
3332
conceal:list('line_patterns', 'string')

lua/render-markdown/config/heading.lua

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
---@field icons render.md.heading.String
66
---@field position render.md.heading.Position
77
---@field signs string[]
8-
---@field width render.md.base.Width|(render.md.base.Width)[]
8+
---@field width render.md.heading.Width|(render.md.heading.Width)[]
99
---@field left_margin number|number[]
1010
---@field left_pad number|number[]
1111
---@field right_pad number|number[]
@@ -34,6 +34,12 @@ local Position = {
3434
right = 'right',
3535
}
3636

37+
---@enum render.md.heading.Width
38+
local Width = {
39+
full = 'full',
40+
block = 'block',
41+
}
42+
3743
---@class (exact) render.md.heading.Custom
3844
---@field pattern string
3945
---@field icon? string
@@ -134,15 +140,14 @@ M.default = {
134140

135141
---@param spec render.md.debug.ValidatorSpec
136142
function M.validate(spec)
137-
local Base = require('render-markdown.config.base')
138-
Base.validate(spec)
143+
require('render-markdown.config.base').validate(spec)
139144
spec:type('atx', 'boolean')
140145
spec:type('setext', 'boolean')
141146
spec:type('sign', 'boolean')
142147
spec:list('icons', 'string', 'function')
143148
spec:one_of('position', vim.tbl_values(Position))
144149
spec:list('signs', 'string')
145-
spec:one_or_list_of('width', vim.tbl_values(Base.Width))
150+
spec:one_or_list_of('width', vim.tbl_values(Width))
146151
spec:list('left_margin', 'number', 'number')
147152
spec:list('left_pad', 'number', 'number')
148153
spec:list('right_pad', 'number', 'number')

lua/render-markdown/config/html.lua

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,7 @@ M.default = {
3737

3838
---@param spec render.md.debug.ValidatorSpec
3939
function M.validate(spec)
40-
local Base = require('render-markdown.config.base')
41-
Base.validate(spec)
40+
require('render-markdown.config.base').validate(spec)
4241
spec:nested('comment', function(comment)
4342
comment:type('conceal', 'boolean')
4443
comment:type('text', { 'string', 'nil' })

0 commit comments

Comments
 (0)