Skip to content

Commit 8debb17

Browse files
chore: update changelog
1 parent a212596 commit 8debb17

File tree

6 files changed

+42
-41
lines changed

6 files changed

+42
-41
lines changed

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,13 @@
44

55
### Features
66

7+
- use changed tick to determine whether we should parse instead of event [d69f0d8](https://github.com/MeanderingProgrammer/render-markdown.nvim/commit/d69f0d8c80ba293d25dad498ec86e9b583a6bbbf)
8+
- rely on buffer enabled value rather than state enabled [ca5c29f](https://github.com/MeanderingProgrammer/render-markdown.nvim/commit/ca5c29f6032338b71bdcae9b3e525d131557d363)
9+
- change heading background default links [dac01bd](https://github.com/MeanderingProgrammer/render-markdown.nvim/commit/dac01bd6660af337613e8cfcb23a4aec5d3c0e38)
710
- allow checkbox to render bullet [#423](https://github.com/MeanderingProgrammer/render-markdown.nvim/issues/423)
811
[a1b0988](https://github.com/MeanderingProgrammer/render-markdown.nvim/commit/a1b0988f5ab26698afb56b9c2f0525a4de1195c1)
912
- include highlight query files in checkhealth [4f05de7](https://github.com/MeanderingProgrammer/render-markdown.nvim/commit/4f05de7536571e231b66dd0363af347b162b5fd7)
13+
- pad suffix of latex so backgrounds are aligned [a212596](https://github.com/MeanderingProgrammer/render-markdown.nvim/commit/a2125961287c78dfc03cb628b7bed7f91b70fd45)
1014

1115
## 8.4.0 (2025-05-08)
1216

lua/render-markdown/core/log.lua

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,12 @@ function M.node(capture, node)
8585
})
8686
end
8787

88+
---@param buf integer
89+
---@param ... string
90+
function M.attach(buf, ...)
91+
M.buf('info', 'Attach', buf, ...)
92+
end
93+
8894
---Encountered if new type is seen in a particular node
8995
---@param buf integer
9096
---@param ... string

lua/render-markdown/core/manager.lua

Lines changed: 13 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ function M.set_buf(buf, enabled)
8989
else
9090
config.enabled = not config.enabled
9191
end
92-
M.update(buf, 'UserCommand')
92+
ui.update(buf, Env.buf.win(buf), 'UserCommand', true)
9393
end
9494
end
9595

@@ -143,8 +143,8 @@ function M.attach(buf)
143143
if not state.get(buf).enabled then
144144
return
145145
end
146-
local win, windows = Env.win.current(), Env.buf.windows(buf)
147-
win = vim.tbl_contains(windows, win) and win or windows[1]
146+
local win, wins = Env.win.current(), Env.buf.windows(buf)
147+
win = vim.tbl_contains(wins, win) and win or wins[1]
148148
if not win then
149149
return
150150
end
@@ -154,56 +154,48 @@ function M.attach(buf)
154154
})
155155

156156
if config.enabled then
157-
M.update(buf, 'Initial')
157+
ui.update(buf, Env.buf.win(buf), 'Initial', true)
158158
end
159159
end
160160

161-
---@private
162-
---@param buf integer
163-
---@param event string
164-
function M.update(buf, event)
165-
ui.update(buf, Env.buf.win(buf), event, true)
166-
end
167-
168161
---@private
169162
---@param buf integer
170163
---@return boolean
171164
function M.should_attach(buf)
172-
log.buf('info', 'Attach', buf, 'start')
165+
log.attach(buf, 'start')
173166

174167
if M.attached(buf) then
175-
log.buf('info', 'Attach', buf, 'skip', 'already attached')
168+
log.attach(buf, 'skip', 'already attached')
176169
return false
177170
end
178171

179172
if not vim.api.nvim_buf_is_valid(buf) then
180-
log.buf('info', 'Attach', buf, 'skip', 'invalid')
173+
log.attach(buf, 'skip', 'invalid')
181174
return false
182175
end
183176

184177
local file_type = Env.buf.get(buf, 'filetype')
185178
local file_types = M.config.file_types
186179
if not vim.tbl_contains(file_types, file_type) then
187-
local reason = file_type .. ' /∈ ' .. vim.inspect(file_types)
188-
log.buf('info', 'Attach', buf, 'skip', 'file type', reason)
180+
local reason = ('%s /∈ %s'):format(file_type, vim.inspect(file_types))
181+
log.attach(buf, 'skip', 'file type', reason)
189182
return false
190183
end
191184

192-
local config = state.get(buf)
193185
local file_size = Env.file_size_mb(buf)
194-
local max_file_size = config.max_file_size
186+
local max_file_size = state.get(buf).max_file_size
195187
if file_size > max_file_size then
196188
local reason = ('%f > %f'):format(file_size, max_file_size)
197-
log.buf('info', 'Attach', buf, 'skip', 'file size', reason)
189+
log.attach(buf, 'skip', 'file size', reason)
198190
return false
199191
end
200192

201193
if M.config.ignore(buf) then
202-
log.buf('info', 'Attach', buf, 'skip', 'user ignore')
194+
log.attach(buf, 'skip', 'user ignore')
203195
return false
204196
end
205197

206-
log.buf('info', 'Attach', buf, 'success')
198+
log.attach(buf, 'success')
207199
M.buffers[#M.buffers + 1] = buf
208200
return true
209201
end

lua/render-markdown/core/ui.lua

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -115,9 +115,9 @@ function Updater:run()
115115
and Env.win.view(self.win).leftcol == 0
116116
log.buf('info', 'Render', self.buf, render)
117117
local next_state = render and 'rendered' or 'default'
118-
for _, window in ipairs(Env.buf.windows(self.buf)) do
118+
for _, win in ipairs(Env.buf.windows(self.buf)) do
119119
for name, value in pairs(self.config.win_options) do
120-
Env.win.set(window, name, value[next_state])
120+
Env.win.set(win, name, value[next_state])
121121
end
122122
end
123123
if not render then

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

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

scripts/update.py

Lines changed: 16 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -62,16 +62,15 @@ def to_str(self) -> str:
6262

6363

6464
def main() -> None:
65-
init = Path("lua/render-markdown/init.lua")
66-
update_types(init)
67-
update_readme(init)
68-
update_handlers()
65+
root = next(Path("lua").glob("*"))
66+
update_types(root)
67+
update_readme(root)
68+
update_handlers(root)
6969

7070

71-
def update_types(init: Path) -> None:
72-
configs = list(Path("lua/render-markdown/config").iterdir())
73-
configs.sort(key=str)
74-
files: list[Path] = [init] + configs
71+
def update_types(root: Path) -> None:
72+
files: list[Path] = [root.joinpath("init.lua")]
73+
files.extend(sorted(root.joinpath("config").iterdir()))
7574

7675
classes: list[str] = ["---@meta"]
7776
for definition in get_definitions(files):
@@ -80,14 +79,14 @@ def update_types(init: Path) -> None:
8079
if definition.exact() and definition.config():
8180
classes.append(definition.to_user())
8281

83-
types = Path("lua/render-markdown/types.lua")
82+
types = root.joinpath("types.lua")
8483
types.write_text("\n\n".join(classes) + "\n")
8584

8685

87-
def update_readme(init: Path) -> None:
86+
def update_readme(root: Path) -> None:
8887
readme = Path("README.md")
8988
old = get_code_block(readme, "log_level", 1)
90-
new = wrap_setup(get_default(init))
89+
new = wrap_setup(root, get_default(root.joinpath("init.lua")))
9190
while True:
9291
match = re.search(r"require\('(.*?)'\)\.default", new)
9392
if match is None:
@@ -116,20 +115,20 @@ def update_readme(init: Path) -> None:
116115
]
117116
for parameter in parameters:
118117
old_param = get_code_block(readme, f"\n {parameter} = {{", 2)
119-
new_param = wrap_setup(get_config_for(new, parameter))
118+
new_param = wrap_setup(root, get_config_for(new, parameter))
120119
text = text.replace(old_param, new_param)
121120

122121
readme.write_text(text)
123122

124123

125-
def wrap_setup(s: str) -> str:
126-
return f"require('render-markdown').setup({s})\n"
124+
def wrap_setup(root: Path, s: str) -> str:
125+
return f"require('{root.name}').setup({s})\n"
127126

128127

129-
def update_handlers() -> None:
128+
def update_handlers(root: Path) -> None:
130129
files: list[Path] = [
131-
Path("lua/render-markdown/config/handlers.lua"),
132-
Path("lua/render-markdown/lib/marks.lua"),
130+
root.joinpath("config/handlers.lua"),
131+
root.joinpath("lib/marks.lua"),
133132
]
134133
name_lua = {lua.name(): lua for lua in get_definitions(files)}
135134
names = [

0 commit comments

Comments
 (0)