Skip to content

armgit / zed

Public Imported from GitHub
0

Code at the speed of thought – Zed is a high-performance, multiplayer code editor from the creators of Atom and Tree-sitter.

markdown: Fix HTML tables with mismatching columns (#41108)

Remco Smits986ca19516e0
diff --git a/crates/markdown_preview/src/markdown_renderer.rs b/crates/markdown_preview/src/markdown_renderer.rs
index 0abb12015af..c6f4354423e 100644
--- a/crates/markdown_preview/src/markdown_renderer.rs
+++ b/crates/markdown_preview/src/markdown_renderer.rs
@@ -553,6 +553,23 @@ fn render_markdown_table(parsed: &ParsedMarkdownTable, cx: &mut RenderContext) -
col_idx += cell.col_span;
}
+
+ // Fill remaining columns with empty cells if needed
+ while col_idx < max_column_count {
+ if grid_occupied[row_idx][col_idx] {
+ col_idx += 1;
+ continue;
+ }
+
+ let empty_cell = div()
+ .border_1()
+ .size_full()
+ .border_color(cx.border_color)
+ .when(row_idx % 2 == 1, |this| this.bg(cx.panel_background_color));
+
+ cells.push(empty_cell);
+ col_idx += 1;
+ }
}
cx.with_common_p(div())