Skip to content

Commit 3115ff7

Browse files
fix: skip nodes with errors
## Details Some treesitter errors within nodes are harmless, while others can cause constant errors to be surfaced to the user. Rather than handling errors in different ways, skip all nodes that contain errors. We check for errors at the query level, you can think of this like a single instance of a component like a code block. If we checked at the top level then any error anywhere in the tree would result in nothing being rendered. This should resolve instances of `E976: Using a Blob as a String` as mentioned here: #451 Can reproduce by using the null-byte: `printf '\x00\n' > temp.md`
1 parent c809fc1 commit 3115ff7

File tree

5 files changed

+11
-10
lines changed

5 files changed

+11
-10
lines changed

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@
99
- change code.border to thin instead of hide if version < 0.11.0 [a706be7](https://github.com/MeanderingProgrammer/render-markdown.nvim/commit/a706be739257a6203524741da2da540bc190bbe2)
1010
- allow image links to use custom icons based on destination [ac3e74f](https://github.com/MeanderingProgrammer/render-markdown.nvim/commit/ac3e74ffdb0bcf7282445ac12083fb6bd44858a1)
1111
- better support for reloading with lazy.nvim [24aacee](https://github.com/MeanderingProgrammer/render-markdown.nvim/commit/24aacee83544ca113055564ed22be7852067c342)
12+
- change concealcursor value to nvic when user disables anti conceal [#463](https://github.com/MeanderingProgrammer/render-markdown.nvim/issues/463)
13+
[c809fc1](https://github.com/MeanderingProgrammer/render-markdown.nvim/commit/c809fc129f842a7055c672593d24be6346bcc673)
1214

1315
### Bug Fixes
1416

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

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

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

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

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

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -55,9 +55,6 @@ function Render:setup()
5555
if self.config.style == 'none' then
5656
return false
5757
end
58-
if self.node:get():has_error() then
59-
return false
60-
end
6158

6259
-- ensure delimiter and rows exist
6360
local delim_node = nil ---@type render.md.Node?

lua/render-markdown/request/view.lua

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -67,11 +67,13 @@ end
6767
---@param query vim.treesitter.Query
6868
---@param callback fun(capture: string, node: render.md.Node)
6969
function View:nodes(root, query, callback)
70-
self:query(root, query, function(id, ts_node)
71-
local capture = query.captures[id]
72-
local node = Node.new(self.buf, ts_node)
73-
log.node(capture, node)
74-
callback(capture, node)
70+
self:query(root, query, function(id, ts)
71+
if not ts:has_error() then
72+
local capture = query.captures[id]
73+
local node = Node.new(self.buf, ts)
74+
log.node(capture, node)
75+
callback(capture, node)
76+
end
7577
end)
7678
end
7779

0 commit comments

Comments
 (0)