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_preview: Stop rounding image corners (#65474)

Om Chillurea4b39c38e005
diff --git a/crates/markdown/src/markdown.rs b/crates/markdown/src/markdown.rs
index 44e732c06c2..ee6817bf699 100644
--- a/crates/markdown/src/markdown.rs
+++ b/crates/markdown/src/markdown.rs
@@ -133,6 +133,7 @@ pub struct MarkdownStyle {
pub prevent_mouse_interaction: bool,
pub table_columns_min_size: bool,
pub soft_break_as_hard_break: bool,
+ pub rounded_images: bool,
}
impl Default for MarkdownStyle {
@@ -162,6 +163,7 @@ impl Default for MarkdownStyle {
prevent_mouse_interaction: false,
table_columns_min_size: false,
soft_break_as_hard_break: false,
+ rounded_images: true,
}
}
}
@@ -409,6 +411,10 @@ impl MarkdownStyle {
self.heading_border_color = Some(colors.border_variant);
+ // The preview should match how GitHub and browsers render images, which
+ // keep their own corners (e.g. shields.io badges).
+ self.rounded_images = false;
+
self
}
@@ -2031,7 +2037,7 @@ impl MarkdownElement {
.id(("markdown-image", range.start))
.min_w_0()
.max_w_full()
- .rounded_md()
+ .when(self.style.rounded_images, |this| this.rounded_md())
.mr_1()
.mb_1()
.when_some(height, |this, height| this.h(height))