Skip to content

Commit fa67110

Browse files
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).
1 parent 33456cb commit fa67110

1 file changed

Lines changed: 13 additions & 0 deletions

File tree

lua/markview/parsers/markdown.lua

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -885,8 +885,19 @@ markdown.table = function (_, _, text, range)
885885
end
886886

887887
for l, line in ipairs(text) do
888+
--- Strip block_continuation prefixes(e.g. `> `)
889+
--- from lines after the first.
890+
--- `get_node_text()` only applies col_start to line 1.
891+
if l > 1 then
892+
line = line:sub(range.col_start + 1);
893+
end
894+
888895
local row_text = line;
889896

897+
if row_text == "" or row_text:match("^%s*$") then
898+
goto continue;
899+
end
900+
890901
if l == 1 then
891902
header = line_processor(row_text);
892903
elseif l == 2 then
@@ -917,6 +928,8 @@ markdown.table = function (_, _, text, range)
917928
else
918929
table.insert(rows, line_processor(row_text))
919930
end
931+
932+
::continue::
920933
end
921934

922935
local top_border, border_overlap = overlap(range.row_start);

0 commit comments

Comments
 (0)