ITADN

Markdown preview Strong/bold text ignores markdown_preview_theme, always uses main theme's text color

#62814Openhankeybannister 创建于 3 天前
state:needs triage
H
hankeybannistercommented
**Summary** When `markdown_preview_theme` is set to a theme different from the active editor theme, bold (`**text**`) spans in the rendered markdown preview still render using the *main* editor theme's `text` color instead of the override theme's color. Every other styled element in the same preview (headings, links, inline code, background) correctly respects the override — only `Strong` does not. **Root cause** `crates/markdown/src/markdown.rs`, in the `MarkdownTag::Strong` handler: ```rust MarkdownTag::Strong => builder.push_text_style(TextStyleRefinement { font_weight: Some(FontWeight::BOLD), color: Some(cx.theme().colors().text), ..Default::default() }), ``` `cx.theme().colors().text` reads the globally active editor theme, not the `colors`/`syntax` parameters that `MarkdownStyle::themed_with_overrides` (added in #54003) threads through for the rest of the style (e.g. `self.heading.text.color = Some(colors.text)` correctly uses the override). `Strong` never consults the override at all. **Repro** 1. Set an editor theme pair where the active theme is dark, e.g. `"theme": { "mode": "system", "dark": "One Dark", "light": "One Light" }`, with the system in Dark Mode. 2. Set `"markdown_preview_theme"` to any light custom/built-in theme. 3. Open a markdown file containing `**bold text**` and open its preview (`markdown: open preview`). 4. Bold text renders in One Dark's light gray-blue `text` color (`#dce0e5ff`) against the light preview background from the override theme — very low contrast, nearly illegible — while surrounding headings/body/links correctly use the override theme's colors. **Expected** `Strong` text should use the same color source as headings and body text — i.e. the overridden `colors.text` (or a dedicated syntax highlight for bold), not `cx.theme()`. **Related** This looks like the same class of issue as the `editor.foreground` vs `text` mismatch noted in https://github.com/zed-industries/zed/discussions/43384 (comment from @alexojegu, Mar 30, 2026) — background correctly following an overridden/contextual source while a specific foreground property is hardcoded to the wrong theme. **Version** Zed 1.15.0 stable (`e17dc4f`), macOS (Apple Silicon).
0 条评论