bug: grid border errors when pipe_table.wrap = false

未关闭
#721 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

维护者通常 21 天内回复

@StudentWeis 已经在做这个了。

开始于 2026年11月9日。

  • #722 来自 @StudentWeis —— 未关闭

评估

难度
2/5
预计耗时
1-3 小时
新手友好度
35/100
Issue 类型
缺陷
描述清晰度
描述清楚
活跃度
停滞
技术栈
lua, markdown, neovim
领域
devtools

调研方向

Read lua/render-markdown/render/markdown/table.lua around border_row and the parser logic that populates data.prefixes when wrapping is enabled. Compare the existing grid table test with the proposed wrap = false case, then run the table tests. Done means grid tables render with body separators and no error when wrapping is disabled, including inside list items.

由索引模型根据 Issue 内容生成。

描述

Neovim version (nvim -v)

0.12.6

Neovim distribution

N/A (custom config, vim.pack)

Operating system

macOS 27.2

Terminal emulator / GUI

Any. Reproduced in an automated PTY harness and in the plugin's own test runner.

Describe the bug

With pipe_table.grid = true and pipe_table.wrap = false, rendering a table fails on every pass and the table is never rendered. wrap = false is a documented option (the default grid = true + wrap = true combination works), so the two seem expected to compose.

The error comes from the body separator added by grid: Render:border_row appends the row prefix unconditionally for position == 'body':

attempt to index local 'other' (a nil value)
  lua/render-markdown/lib/line.lua:39 in function 'extend'
  lua/render-markdown/render/markdown/table.lua:247 in function 'border_row'
  lua/render-markdown/render/markdown/table.lua:47 in function 'run'

Parser:parse only fills data.prefixes inside if layout.wrap then, so with wrap = false the table is empty and prefixes[row.node.start_row] is nil.

Reproduction, with pipe_table = { grid = true, wrap = false }:

| A | B |
| --- | --- |
| 1 | 2 |
| 3 | 4 |

The same happens inside a list item, and border_virtual = true does not matter.

Adding a test case that mirrors the existing grid test but with wrap = false reproduces it in the repo test suite:

it('grid without wrap', function()
    util.setup.text(lines, { pipe_table = { grid = true, wrap = false } })
    ...
Expected behavior

Table renders with a separator line between body rows, aligned to the table start column, without errors.

Healthcheck output
render-markdown.nvim [versions] ~
- ✅ OK neovim >= 0.11
- ✅ OK tree-sitter ABI: 15
- ✅ OK plugin: 8.14.12

render-markdown.nvim [configuration] ~
- ✅ OK valid

render-markdown.nvim [tree-sitter markdown] ~
- ✅ OK parser: installed
- ✅ OK ABI: 15
- ✅ OK highlights: ~/.local/share/nvim/site/queries/markdown/highlights.scm
- ✅ OK highlighter: enabled

render-markdown.nvim [tree-sitter markdown_inline] ~
- ✅ OK parser: installed
- ✅ OK ABI: 15
- ✅ OK highlights: ~/.local/share/nvim/site/queries/markdown_inline/highlights.scm

render-markdown.nvim [icons] ~
- ✅ OK using: mini.icons

render-markdown.nvim [conflicts] ~
- ✅ OK headlines: not installed
- ✅ OK markview: not installed
- ✅ OK obsidian: not installed
Plugin configuration
require('render-markdown').setup({
    pipe_table = { border_virtual = true, wrap = false, grid = true },
})

Also fails with the minimal config below (no border_virtual):

require('render-markdown').setup({
    pipe_table = { wrap = false, grid = true },
})
Plugin error log
Error in command line:
vim.schedule callback: ./lua/render-markdown/lib/line.lua:39: attempt to index local 'other' (a nil value)
stack traceback:
	./lua/render-markdown/lib/line.lua:39: in function 'extend'
	./lua/render-markdown/render/markdown/table.lua:247: in function 'border_row'
	./lua/render-markdown/render/markdown/table.lua:47: in function 'run'
	./lua/render-markdown/render/base.lua:21: in function 'execute'
	./lua/render-markdown/handler/markdown.lua:58: in function 'callback'
	./lua/render-markdown/request/view.lua:76: in function 'callback'
	./lua/render-markdown/request/view.lua:88: in function 'query'
	./lua/render-markdown/request/view.lua:71: in function 'nodes'
	./lua/render-markdown/handler/markdown.lua:55: in function 'parse'
	./lua/render-markdown/core/handlers.lua:94: in function 'tree'
	./lua/render-markdown/core/handlers.lua:51: in function 'run'
	./lua/render-markdown/core/ui.lua:156: in function 'callback'
	./lua/render-markdown/request/view.lua:64: in function 'parse'
	./lua/render-markdown/core/ui.lua:153: in function 'parse'
	./lua/render-markdown/core/ui.lua:126: in function 'render'
	./lua/render-markdown/core/ui.lua:112: in function 'run'
	./lua/render-markdown/core/ui.lua:78: in function <./lua/render-markdown/core/ui.lua:77>
主要语言
Lua
星标
5.2k
派生
155
平均合并
5 天 10 小时
30 天内合并 PR
1

环境准备

这个项目没有提供开发容器、Dockerfile 或贡献指南,环境需要你自己搭建:先看它的 README,通用步骤见我们的新手贡献指南。

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

MeanderingProgrammer/render-markdown.nvim 的其他 Issue

查看 MeanderingProgrammer/render-markdown.nvim 的全部 Issue

相似的 Issue

更多 Lua Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。