Code at the speed of thought – Zed is a high-performance, multiplayer code editor from the creators of Atom and Tree-sitter.
markdown_preview: Fix markdown tables taking up the full width of the parent element (#43555)
Remco Smits7e177c496ccd
diff --git a/crates/gpui/src/taffy.rs b/crates/gpui/src/taffy.rsindex 11cb0872861..c3113ad2cb9 100644--- a/crates/gpui/src/taffy.rs+++ b/crates/gpui/src/taffy.rs@@ -8,6 +8,7 @@ use std::{fmt::Debug, ops::Range};use taffy::{TaffyTree, TraversePartialTree as _,geometry::{Point as TaffyPoint, Rect as TaffyRect, Size as TaffySize},+ prelude::min_content,style::AvailableSpace as TaffyAvailableSpace,tree::NodeId,};@@ -295,7 +296,7 @@ trait ToTaffy<Output> {impl ToTaffy<taffy::style::Style> for Style {fn to_taffy(&self, rem_size: Pixels, scale_factor: f32) -> taffy::style::Style {- use taffy::style_helpers::{fr, length, minmax, repeat};+ use taffy::style_helpers::{length, minmax, repeat};fn to_grid_line(placement: &Range<crate::GridPlacement>,@@ -309,8 +310,8 @@ impl ToTaffy<taffy::style::Style> for Style {fn to_grid_repeat<T: taffy::style::CheapCloneStr>(unit: &Option<u16>,) -> Vec<taffy::GridTemplateComponent<T>> {- // grid-template-columns: repeat(<number>, minmax(0, 1fr));- unit.map(|count| vec![repeat(count, vec![minmax(length(0.0), fr(1.0))])])+ // grid-template-columns: repeat(<number>, minmax(0, min-content));+ unit.map(|count| vec![repeat(count, vec![minmax(length(0.0), min_content())])]).unwrap_or_default()}diff --git a/crates/markdown_preview/src/markdown_renderer.rs b/crates/markdown_preview/src/markdown_renderer.rsindex b229705692c..d9997b54274 100644--- a/crates/markdown_preview/src/markdown_renderer.rs+++ b/crates/markdown_preview/src/markdown_renderer.rs@@ -520,7 +520,6 @@ fn render_markdown_table(parsed: &ParsedMarkdownTable, cx: &mut RenderContext) -.px_2().py_1().border_1()- .size_full().border_color(cx.border_color).when(cell.is_header, |this| {this.bg(cx.title_bar_background_color)@@ -551,7 +550,6 @@ fn render_markdown_table(parsed: &ParsedMarkdownTable, cx: &mut RenderContext) -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));@@ -560,7 +558,7 @@ fn render_markdown_table(parsed: &ParsedMarkdownTable, cx: &mut RenderContext) -}}- cx.with_common_p(div())+ cx.with_common_p(v_flex().items_start()).when_some(parsed.caption.as_ref(), |this, caption| {this.children(render_markdown_text(caption, cx))})