From db43f05e398036f08e544c03cbc068216c7a0aaa Mon Sep 17 00:00:00 2001 From: Ibrahim Khan <2005ibrahimkhan@gmail.com> Date: Fri, 6 Nov 2026 13:29:11 +0000 Subject: [PATCH] markdown: Respect preview theme for bold text (#63940) # Objective Fixes #62814. Zed displays Markdown files in two ways: - The editor shows the Markdown source that you type, such as `**bold text**`. - The Markdown preview shows the same file as a formatted document, with the `**` markers hidden. The editor and the formatted preview can use different color themes. Currently, normal words in the formatted preview use the preview colors, but bold words incorrectly use the editor colors. For example, with a dark editor and a light preview, bold words can appear very light against a light background and become difficult to read. ## Solution Make bold formatting change only the font weight. Bold words now inherit the color of the surrounding formatted document, including the color selected by the Markdown preview theme. Related work: #62837 identified the same root cause and attempted a fix but was closed. ## Testing - `cargo test -p markdown` - `cargo test -p markdown_preview` - `cargo fmt --all -- --check` - `./script/clippy -p markdown` ## Self-Review Checklist: - [x] I reviewed the diff for quality, security, and reliability - [x] Unsafe blocks, if any, have justifying comments - [x] The content follows Zed UI standards - [x] Tests cover the changed behavior - [x] Performance impact has been considered and is acceptable Release Notes: - Fixed bold words using the wrong color theme in Markdown previews. --------- Co-authored-by: MrSubidubi --- crates/markdown/src/markdown.rs | 1 - 1 file changed, 1 deletion(-) diff --git a/crates/markdown/src/markdown.rs b/crates/markdown/src/markdown.rs index ee6817bf699..1cecbdc0fdd 100644 --- a/crates/markdown/src/markdown.rs +++ b/crates/markdown/src/markdown.rs @@ -3013,7 +3013,6 @@ impl Element for MarkdownElement { }), MarkdownTag::Strong => builder.push_text_style(TextStyleRefinement { font_weight: Some(FontWeight::BOLD), - color: Some(cx.theme().colors().text), ..Default::default() }), MarkdownTag::Strikethrough => {