From 78ba9e708356a8a106c09b7bed5bc2574fedcaf7 Mon Sep 17 00:00:00 2001 From: Immanuel Haffner Date: Thu, 19 Mar 2026 09:52:26 +0100 Subject: [PATCH 1/2] fix: strip blockquote continuation prefix from table rows in parser get_node_text() only applies col_start offset to the first line of a tree-sitter node. For tables inside blockquotes, lines 2+ retain the '> ' prefix, causing the lpeg row parser to fail silently and produce empty results. This left separator and data rows unrendered. Strip the prefix via line:sub(col_start + 1) for lines after the first, and skip empty/blank lines (e.g. trailing '>' markers). --- lua/markview/parsers/markdown.lua | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/lua/markview/parsers/markdown.lua b/lua/markview/parsers/markdown.lua index 47b83872..d1c521f5 100644 --- a/lua/markview/parsers/markdown.lua +++ b/lua/markview/parsers/markdown.lua @@ -885,8 +885,19 @@ markdown.table = function (_, _, text, range) end for l, line in ipairs(text) do + --- Strip block_continuation prefixes(e.g. `> `) + --- from lines after the first. + --- `get_node_text()` only applies col_start to line 1. + if l > 1 then + line = line:sub(range.col_start + 1); + end + local row_text = line; + if row_text == "" or row_text:match("^%s*$") then + goto continue; + end + if l == 1 then header = line_processor(row_text); elseif l == 2 then @@ -917,6 +928,8 @@ markdown.table = function (_, _, text, range) else table.insert(rows, line_processor(row_text)) end + + ::continue:: end local top_border, border_overlap = overlap(range.row_start); From b49f40744431684add34dc723abf1c35852552e9 Mon Sep 17 00:00:00 2001 From: Immanuel Haffner Date: Fri, 3 Jul 2026 15:03:28 +0000 Subject: [PATCH 2/2] test: add blockquote table parser fixture Repro for the block-continuation prefix fix. With tables nested in blockquotes, get_node_text() leaves the '> ' prefix on lines 2+, so the lpeg row parser fails on the separator and data rows. Observable via markdown.parse: blockquoted tables come back with alignments=0 (separator unparsed) and the separator leaking into the row count, while the plain control table parses correctly. This fixture covers a plain control table, a simple blockquote table, a nested blockquote table, and a blockquote table with alignment markers. --- test/blockquote_table.md | 36 ++++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) create mode 100644 test/blockquote_table.md diff --git a/test/blockquote_table.md b/test/blockquote_table.md new file mode 100644 index 00000000..97a58ae1 --- /dev/null +++ b/test/blockquote_table.md @@ -0,0 +1,36 @@ +; Tables inside blockquotes — parser continuation prefix +A table nested in a blockquote has a `> ` (block continuation) prefix on every +line. `get_node_text()` only strips the node's `col_start` from the *first* +line, so lines 2+ keep the `> `. The lpeg row parser in +`parsers/markdown.lua` then fails silently on those lines, leaving the +separator and data rows unrendered (only the header shows, or the table renders +empty/broken). +Open this file: every table below should render fully — header, separator, and +all data rows — with borders aligned. The blockquoted tables should look like +the plain control table, just indented under the quote marker. +### Control: table not in a blockquote +| Name | Role | +|-------|----------| +| Alice | Engineer | +| Bob | Designer | +### Table inside a blockquote +> Some quoted intro text. +> +> | Name | Role | +> |-------|----------| +> | Alice | Engineer | +> | Bob | Designer | +> +> Trailing quoted text after the table. +### Table inside a nested blockquote +> Outer quote. +> +> > | Key | Value | +> > |-------|-------| +> > | alpha | 1 | +> > | beta | 2 | +### Blockquote table with alignment markers +> | Left | Center | Right | +> |:-----|:------:|------:| +> | a | b | c | +> | dd | ee | ff |