Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions lua/markview/parsers/markdown.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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);
Expand Down
36 changes: 36 additions & 0 deletions test/blockquote_table.md
Original file line number Diff line number Diff line change
@@ -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 |
Loading