bug: pipe table inside a markdown code block is wider than `code.width = 'block'`, so cell text gets hidden
Maintainer antworten meist innerhalb von 6 Tagen
Dieses Issue hat noch niemand übernommen.
Bewertung
- Schwierigkeit
- 4/5
- Geschätzter Aufwand
- 1-2 Tage
- Anfängerfreundlichkeit
- 55/100
Rechercherichtung
Start by reading core/handlers.lua and code.lua, which the issue identifies as the handler ordering and block sizing entry points; compare how the outer fenced block is sized with how the injected Markdown table is rendered. Reproduce with the provided nested table and code = { width = 'block', right_pad = 1 }. Done means the rendered table fits its block or its text remains visible, with existing block sizing behavior preserved.
Vom Indexierungsmodell aus dem Issue-Text verfasst.
Beschreibung
Neovim version (nvim -v)
0.12.6
Neovim distribution
N/A
Operating system
Linux (Ubuntu, kernel 6.8)
Terminal emulator / GUI
WezTerm
Describe the bug
When a pipe table is written inside a fenced code block whose language is markdown,
the rendered table can be wider than the code block, which is sized with width = 'block'.
Buffer characters that end up past the block's right edge are hidden by the background
virt_text_win_col padding. Inline padding and the overlay │ are still drawn, so one
character goes missing in the middle of a cell.
Input (outer fence is 4 backticks only for GitHub display):
```markdown
| id | name |
|-|-|
|1| ichiro|
|100|momotake|
```
Rendered with the minimal configuration below (the e of momotake is missing):
┌─────┬──────────┐
│ id │ name │
├─────┼──────────┤
│ 1 │ ichiro │
│ 100 │ momotak │
└─────┴──────────┘
What happens:
- The code block body width is computed from the raw line widths:
the longest line is|100|momotake|, which is 14 cells, plusright_pad = 1, so 15. - The table renderer adds padding around tightly written cells (
|100|->│ 100 │),
so that row is rendered 18 cells wide and theelands in column 15. - The background padding at
virt_text_win_col = 15covers buffer text only, so thee
is hidden. The inline spaces and the│overlay after it are still drawn.
If no buffer character crosses the edge, nothing is hidden, but the table still sticks out
past the block. For example, with momo instead of momotake, the table is 16 cells wide
while the block is only 14. Tables already written with spaces
(| 100 | momotake |) barely change width, so they are not affected.
doc/limitations.md says the raw string width "is if anything going to be an over-estimate".
Nested markdown tables are a case where it is an under-estimate.
Expected behavior
The code block's block width accounts for the rendered width of the nested table,
or at least never hides the table's text.
Healthcheck output
==============================================================================
render-markdown: ✅
render-markdown.nvim [versions] ~
- ✅ OK neovim >= 0.11
- ✅ OK tree-sitter ABI: 15
- ✅ OK plugin: 8.14.1
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 [tree-sitter html] ~
- ✅ OK parser: installed
- ✅ OK ABI: 14
render-markdown.nvim [tree-sitter latex] ~
- ✅ OK parser: installed
- ✅ OK ABI: 15
render-markdown.nvim [tree-sitter yaml] ~
- ✅ OK parser: installed
- ✅ OK ABI: 15
render-markdown.nvim [icons] ~
- ✅ OK using: mini.icons
render-markdown.nvim [latex] ~
- ✅ OK using: { "utftex", "latex2text" }
render-markdown.nvim [conflicts] ~
- ✅ OK headlines: not installed
- ✅ OK markview: not installed
- ✅ OK obsidian: installed but should not conflict
- ✅ OK snacks: not installed
Plugin configuration
Minimal configuration that reproduces it:
require('render-markdown').setup({
code = { width = 'block', right_pad = 1 },
})
Plugin error log
N/A
Confirmations
- I have updated this plugin to the latest version using my plugin manager
- I have updated all treesitter parsers (:TSUpdate)
- I have provided the text contained in all screenshots as raw text in this issue. This means if there is a screenshot below it is the copy pasted contents of the file in the screenshot. I understand that my issue will be closed if I have not.
Additional information
This looks like the same root cause as #580: the outer fenced_code_block is rendered
from the top-level tree before the injected markdown tree, so it cannot see how wide the
nested content becomes. One idea I have not tried yet: process nested markdown roots before
their parent in core/handlers.lua, record their marks in the request context, and have
code.lua size the block with context:width() per row. But it changes
handler ordering, and recording marks for the top-level tree has side effects (for example,
section indent marks would feed into heading width), so I wanted to ask before opening a PR.
Would you be open to that direction, or would you prefer another approach? I'm happy to
send a PR.
- Vorherrschende Sprache
- Lua
- Sterne
- 5.2k
- Forks
- 152
- PR-Merge-Kennzahlen
- Keine gemergten PRs in 30 T.
Entwicklungsumgebung
Dieses Projekt bietet weder Dev-Container noch Dockerfile noch Beitragsleitfaden – die Einrichtung liegt bei Ihnen. Beginnen Sie mit der README; die allgemeinen Schritte stehen in unserem Leitfaden für den ersten Beitrag.
Erste Schritte
- Lesen Sie das ganze Issue und danach den Beitragsleitfaden des Projekts.
- Schreiben Sie ins Issue, dass Sie es übernehmen — das erspart doppelte Arbeit.
- Forken Sie das Repository und arbeiten Sie in einem Branch.
- Öffnen Sie einen Pull Request, der die Issue-Nummer nennt.
Mehr aus MeanderingProgrammer/render-markdown.nvim
-
Schwierigkeit 4/5 3-5 Tage Anfängerfreundlichkeit 57/100
MeanderingProgrammer/render-markdown.nvim#712 ·
Maintainer antworten meist innerhalb von 6 Tagen
-
Schwierigkeit 5/5 Über eine Woche Anfängerfreundlichkeit 38/100
MeanderingProgrammer/render-markdown.nvim#711 · 1 Kommentar ·
Maintainer antworten meist innerhalb von 6 Tagen
-
enhancement
Schwierigkeit 4/5 3-5 Tage Anfängerfreundlichkeit 55/100
MeanderingProgrammer/render-markdown.nvim#709 ·
Maintainer antworten meist innerhalb von 6 Tagen
-
enhancement
Schwierigkeit 5/5 Über eine Woche Anfängerfreundlichkeit 38/100
MeanderingProgrammer/render-markdown.nvim#685 ·
Maintainer antworten meist innerhalb von 6 Tagen
-
bug: Tables don't render correctly if the pipe at the end of line is missingEvtl. vergeben @samholmes hat das vor 114 Tagen übernommen. Offenbug
Schwierigkeit 3/5 1-2 Tage Anfängerfreundlichkeit 55/100
MeanderingProgrammer/render-markdown.nvim#673 · 2 Kommentare ·
Maintainer antworten meist innerhalb von 6 Tagen
Alle Issues in MeanderingProgrammer/render-markdown.nvim
Ähnliche Issues
-
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 70/100
-
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 72/100
-
good first issue
Schwierigkeit 2/5 Ein halber Tag Anfängerfreundlichkeit 74/100
whoismjanyway/sereno#14 ·
-
luaebpf: the by-example page's intro names two outcomes of a lowering and omits the stop with the default verdictEvtl. vergeben Ein verknüpfter Pull Request ist offen oder bereits gemergt. Offendocumentation severity: low
Schwierigkeit 1/5 Unter einer Stunde Anfängerfreundlichkeit 88/100
luainkernel/lunatik#2231 ·
Maintainer antworten meist innerhalb von 1 Tag
-
bug triage
Schwierigkeit 1/5 Unter einer Stunde Anfängerfreundlichkeit 85/100
Cidan/BetterBags#1239 ·
Maintainer antworten meist innerhalb von 1 Tag